Current Dev State

This commit is contained in:
Tim Lorsbach
2025-06-23 20:13:54 +02:00
parent b4f9bb277d
commit ded50edaa2
22617 changed files with 4345095 additions and 174 deletions

18
static/js/ketcher2/node_modules/deps-sort/LICENSE generated vendored Normal file
View File

@ -0,0 +1,18 @@
This software is released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

10
static/js/ketcher2/node_modules/deps-sort/bin/cmd.js generated vendored Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env node
var argv = require('subarg')(process.argv.slice(2));
var JSONStream = require('JSONStream');
var sort = require('../')(argv);
var parse = JSONStream.parse([ true ]);
var stringify = JSONStream.stringify();
process.stdin.pipe(parse).pipe(sort).pipe(stringify).pipe(process.stdout);

View File

@ -0,0 +1,6 @@
var sort = require('../')();
var JSONStream = require('JSONStream');
var parse = JSONStream.parse([ true ]);
var stringify = JSONStream.stringify();
process.stdin.pipe(parse).pipe(sort).pipe(stringify).pipe(process.stdout);

122
static/js/ketcher2/node_modules/deps-sort/index.js generated vendored Normal file
View File

@ -0,0 +1,122 @@
var through = require('through2');
var shasum = require('shasum');
module.exports = function (opts) {
if (!opts) opts = {};
var rows = [];
return through.obj(write, end);
function write (row, enc, next) { rows.push(row); next() }
function end () {
var tr = this;
rows.sort(cmp);
sorter(rows, tr, opts);
}
};
function sorter (rows, tr, opts) {
var expose = opts.expose || {};
if (Array.isArray(expose)) {
expose = expose.reduce(function (acc, key) {
acc[key] = true;
return acc;
}, {});
}
var hashes = {}, deduped = {};
var sameDeps = depCmp();
if (opts.dedupe) {
rows.forEach(function (row) {
var h = shasum(row.source);
sameDeps.add(row, h);
if (hashes[h]) {
hashes[h].push(row);
} else {
hashes[h] = [row];
}
});
Object.keys(hashes).forEach(function (h) {
var rows = hashes[h];
while (rows.length > 1) {
var row = rows.pop();
row.dedupe = rows[0].id;
row.sameDeps = sameDeps.cmp(rows[0].deps, row.deps);
deduped[row.id] = rows[0].id;
}
});
}
if (opts.index) {
var index = {};
var offset = 0;
rows.forEach(function (row, ix) {
if (has(expose, row.id)) {
row.index = row.id;
offset ++;
if (expose[row.id] !== true) {
index[expose[row.id]] = row.index;
}
}
else {
row.index = ix + 1 - offset;
}
index[row.id] = row.index;
});
rows.forEach(function (row) {
row.indexDeps = {};
Object.keys(row.deps).forEach(function (key) {
var id = row.deps[key];
row.indexDeps[key] = index[id];
});
if (row.dedupe) {
row.dedupeIndex = index[row.dedupe];
}
tr.push(row);
});
}
else {
rows.forEach(function (row) { tr.push(row) });
}
tr.push(null);
}
function cmp (a, b) {
return a.id + a.hash < b.id + b.hash ? -1 : 1;
}
function has (obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}
function depCmp () {
var deps = {}, hashes = {};
return { add: add, cmp: cmp }
function add (row, hash) {
deps[row.id] = row.deps;
hashes[row.id] = hash;
}
function cmp (a, b, limit) {
if (!a && !b) return true;
if (!a || !b) return false;
var keys = Object.keys(a);
if (keys.length !== Object.keys(b).length) return false;
for (var i = 0; i < keys.length; i++) {
var k = keys[i], ka = a[k], kb = b[k];
var ha = hashes[ka];
var hb = hashes[kb];
var da = deps[ka];
var db = deps[kb];
if (ka === kb) continue;
if (ha !== hb || (!limit && !cmp(da, db, 1))) {
return false;
}
}
return true;
}
}

70
static/js/ketcher2/node_modules/deps-sort/package.json generated vendored Normal file
View File

@ -0,0 +1,70 @@
{
"_from": "deps-sort@^2.0.0",
"_id": "deps-sort@2.0.0",
"_inBundle": false,
"_integrity": "sha1-CRckkC6EZYJg65EHSMzNGvbiH7U=",
"_location": "/deps-sort",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "deps-sort@^2.0.0",
"name": "deps-sort",
"escapedName": "deps-sort",
"rawSpec": "^2.0.0",
"saveSpec": null,
"fetchSpec": "^2.0.0"
},
"_requiredBy": [
"/browserify"
],
"_resolved": "https://registry.npmjs.org/deps-sort/-/deps-sort-2.0.0.tgz",
"_shasum": "091724902e84658260eb910748cccd1af6e21fb5",
"_spec": "deps-sort@^2.0.0",
"_where": "/home/manfred/enviPath/ketcher2/ketcher/node_modules/browserify",
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"bin": {
"deps-sort": "bin/cmd.js"
},
"bugs": {
"url": "https://github.com/substack/deps-sort/issues"
},
"bundleDependencies": false,
"dependencies": {
"JSONStream": "^1.0.3",
"shasum": "^1.0.0",
"subarg": "^1.0.0",
"through2": "^2.0.0"
},
"deprecated": false,
"description": "sort module-deps output for deterministic browserify bundles",
"devDependencies": {
"tap": "^2.2.0"
},
"homepage": "https://github.com/substack/deps-sort",
"keywords": [
"dependency",
"graph",
"browser",
"browserify",
"module-deps",
"browser-pack",
"sorted",
"determinism"
],
"license": "MIT",
"main": "index.js",
"name": "deps-sort",
"repository": {
"type": "git",
"url": "git://github.com/substack/deps-sort.git"
},
"scripts": {
"test": "tap test/*.js"
},
"version": "2.0.0"
}

View File

@ -0,0 +1,83 @@
# deps-sort
sort [module-deps](https://npmjs.org/package/module-deps) output for deterministic
browserify bundles
[![build status](https://secure.travis-ci.org/substack/deps-sort.png)](http://travis-ci.org/substack/deps-sort)
# example
## command-line
```
$ for((i=0;i<5;i++)); do module-deps main.js | deps-sort | browser-pack | md5sum; done
e9e630de2c62953140357db0444c3c3a -
e9e630de2c62953140357db0444c3c3a -
e9e630de2c62953140357db0444c3c3a -
e9e630de2c62953140357db0444c3c3a -
e9e630de2c62953140357db0444c3c3a -
```
or using `browserify --deps` on a [voxeljs](http://voxeljs.com/) project:
```
$ for((i=0;i<5;i++)); do browserify --deps browser.js | deps-sort | browser-pack | md5sum; done
fb418c74b53ba2e4cef7d01808b848e6 -
fb418c74b53ba2e4cef7d01808b848e6 -
fb418c74b53ba2e4cef7d01808b848e6 -
fb418c74b53ba2e4cef7d01808b848e6 -
fb418c74b53ba2e4cef7d01808b848e6 -
```
## api
To use this module programmatically, write streaming object data and read
streaming object data:
``` js
var sort = require('../')();
var JSONStream = require('JSONStream');
var parse = JSONStream.parse([ true ]);
var stringify = JSONStream.stringify();
process.stdin.pipe(parse).pipe(sort).pipe(stringify).pipe(process.stdout);
```
# methods
``` js
var depsSort = require('deps-sort');
```
## var stream = depsSort(opts)
Return a new through `stream` that should get written
[module-deps](https://npmjs.org/package/module-deps) objects and will output
sorted objects.
`opts` can be:
* `opts.index` - when true, for each module-deps row, insert `row.index` with
the numeric index and `row.indexDeps` like `row.deps` but mapping require
strings to row indices
* `opts.expose` - array of names or object mapping names to `true` not to mangle
with integer indexes when `opts.index` is turned on. If `opts.expose` maps names
to strings, those strings will be used to resolve the indexed references.
* `opts.dedupe` - set `row.dedupe` for files that match existing contents. Sets
`row.dedupeIndex` when `opts.index` is enabled. When `row.dedupe` is set,
`row.sameDeps` will be set to a boolean of whether the dependencies at the
dedupe target match (true) or just the source content (false).
# install
With [npm](https://npmjs.org) do:
```
npm install deps-sort
```
# license
MIT

View File

@ -0,0 +1,71 @@
var sort = require('../');
var test = require('tap').test;
var through = require('through2');
test('dedupe-deps-of-deps', function (t) {
t.plan(1);
var s = sort({ dedupe: true });
var rows = [];
function write (row, enc, next) { rows.push(row); next() }
function end () {
t.deepEqual(rows, [
{
id: '/bar.js',
deps: { baz: '/bar/baz.js' },
source: 'TWO'
},
{
id: '/bar/baz.js',
deps: {},
source: 'THREE'
},
{
id: '/foo.js',
deps: { baz: '/foo/baz.js' },
source: 'TWO',
dedupe: '/bar.js',
sameDeps: true
},
{
id: '/foo/baz.js',
deps: {},
source: 'THREE',
dedupe: '/bar/baz.js',
sameDeps: true
},
{
id: '/main.js',
deps: { './foo': '/foo.js', './bar': '/bar.js' },
source: 'ONE'
}
]);
}
s.pipe(through.obj(write, end));
s.write({
id: '/main.js',
deps: { './foo': '/foo.js', './bar': '/bar.js' },
source: 'ONE'
});
s.write({
id: '/foo.js',
deps: { baz : '/foo/baz.js' },
source: 'TWO'
});
s.write({
id: '/bar.js',
deps: { baz : '/bar/baz.js' },
source: 'TWO'
});
s.write({
id: '/foo/baz.js',
deps: {},
source: 'THREE'
});
s.write({
id: '/bar/baz.js',
deps: {},
source: 'THREE'
});
s.end();
});

View File

@ -0,0 +1,39 @@
var sort = require('../');
var test = require('tap').test;
var through = require('through2');
test('dedupe', function (t) {
t.plan(1);
var s = sort({ dedupe: true });
var rows = [];
function write (row, enc, next) { rows.push(row); next() }
function end () {
t.deepEqual(rows, [
{ id: '/bar.js', deps: {}, source: 'TWO' },
{ id: '/foo.js', deps: {}, source: 'TWO', dedupe: '/bar.js', sameDeps: true },
{
id: '/main.js',
deps: { './foo': '/foo.js', './bar': '/bar.js' },
source: 'ONE'
}
]);
}
s.pipe(through.obj(write, end));
s.write({
id: '/main.js',
deps: { './foo': '/foo.js', './bar': '/bar.js' },
source: 'ONE'
});
s.write({
id: '/foo.js',
deps: {},
source: 'TWO'
});
s.write({
id: '/bar.js',
deps: {},
source: 'TWO'
});
s.end();
});

View File

@ -0,0 +1,56 @@
var sort = require('../');
var test = require('tap').test;
var through = require('through2');
test('dedupe index', function (t) {
t.plan(1);
var s = sort({ dedupe: true, index: true });
var rows = [];
function write (row, enc, next) { rows.push(row); next() }
function end () {
t.deepEqual(rows, [
{
id: '/bar.js',
deps: {},
source: 'TWO',
index: 1,
indexDeps: {}
},
{
id: '/foo.js',
deps: {},
source: 'TWO',
dedupe: '/bar.js',
index: 2,
indexDeps: {},
dedupeIndex: 1,
sameDeps: true
},
{
id: '/main.js',
deps: { './foo': '/foo.js', './bar': '/bar.js' },
source: 'ONE',
index: 3,
indexDeps: { './foo': 2, './bar': 1 },
}
]);
}
s.pipe(through.obj(write, end));
s.write({
id: '/main.js',
deps: { './foo': '/foo.js', './bar': '/bar.js' },
source: 'ONE'
});
s.write({
id: '/foo.js',
deps: {},
source: 'TWO'
});
s.write({
id: '/bar.js',
deps: {},
source: 'TWO'
});
s.end();
});

View File

@ -0,0 +1,37 @@
var sort = require('../');
var test = require('tap').test;
var through = require('through2');
test('dedupe undef', function (t) {
t.plan(1);
var s = sort({ dedupe: true });
var rows = [];
function write (row, enc, next) { rows.push(row); next() }
function end () {
t.deepEqual(rows, [
{ id: '/bar.js', source: 'TWO' },
{ id: '/foo.js', source: 'TWO', dedupe: '/bar.js', sameDeps: true },
{
id: '/main.js',
deps: { './foo': '/foo.js', './bar': '/bar.js' },
source: 'ONE'
}
]);
}
s.pipe(through.obj(write, end));
s.write({
id: '/main.js',
deps: { './foo': '/foo.js', './bar': '/bar.js' },
source: 'ONE'
});
s.write({
id: '/foo.js',
source: 'TWO'
});
s.write({
id: '/bar.js',
source: 'TWO'
});
s.end();
});

View File

@ -0,0 +1,38 @@
var sort = require('../');
var test = require('tap').test;
var through = require('through2');
test('expose true', function (t) {
t.plan(1);
var s = sort({ index: true, expose: [ '/foo.js', '/bar.js' ] });
var rows = [];
function write (row, enc, next) { rows.push(row); next() }
function end () {
t.deepEqual(rows, [
{
id: '/bar.js',
deps: {},
index: '/bar.js',
indexDeps: {}
},
{
id: '/foo.js',
deps: { './bar': '/bar.js' },
index: '/foo.js',
indexDeps: { './bar': '/bar.js' }
},
{
id: '/main.js',
deps: { './foo': '/foo.js' },
index: 1,
indexDeps: { './foo': '/foo.js' }
},
]);
}
s.pipe(through.obj(write, end));
s.write({ id: '/main.js', deps: { './foo': '/foo.js' } });
s.write({ id: '/foo.js', deps: { './bar': '/bar.js' } });
s.write({ id: '/bar.js', deps: {} });
s.end();
});

View File

@ -0,0 +1,44 @@
var sort = require('../');
var test = require('tap').test;
var through = require('through2');
test('expose string', function (t) {
t.plan(1);
var s = sort({
index: true,
expose: {
'f': '/foo.js',
'b': '/bar.js'
}
});
var rows = [];
function write (row, enc, next) { rows.push(row); next() }
function end () {
t.deepEqual(rows, [
{
id: '/main.js',
deps: { './foo': '/foo.js' },
index: 1,
indexDeps: { './foo': 'f' }
},
{
id: 'b',
deps: {},
index: 'b',
indexDeps: {}
},
{
id: 'f',
deps: { './bar': '/bar.js' },
index: 'f',
indexDeps: { './bar': 'b' }
}
]);
}
s.pipe(through.obj(write, end));
s.write({ id: '/main.js', deps: { './foo': '/foo.js' } });
s.write({ id: 'f', deps: { './bar': '/bar.js' } });
s.write({ id: 'b', deps: {} });
s.end();
});

View File

@ -0,0 +1,38 @@
var sort = require('../');
var test = require('tap').test;
var through = require('through2');
test('indexed', function (t) {
t.plan(1);
var s = sort({ index: true });
var rows = [];
function write (row, enc, next) { rows.push(row); next() }
function end () {
t.deepEqual(rows, [
{
id: '/bar.js',
deps: {},
index: 1,
indexDeps: {}
},
{
id: '/foo.js',
deps: { './bar': '/bar.js' },
index: 2,
indexDeps: { './bar': 1 }
},
{
id: '/main.js',
deps: { './foo': '/foo.js' },
index: 3,
indexDeps: { './foo': 2 }
},
]);
}
s.pipe(through.obj(write, end));
s.write({ id: '/main.js', deps: { './foo': '/foo.js' } });
s.write({ id: '/foo.js', deps: { './bar': '/bar.js' } });
s.write({ id: '/bar.js', deps: {} });
s.end();
});

23
static/js/ketcher2/node_modules/deps-sort/test/sort.js generated vendored Normal file
View File

@ -0,0 +1,23 @@
var sort = require('../');
var test = require('tap').test;
var through = require('through2');
test('sort', function (t) {
t.plan(1);
var s = sort();
var rows = [];
function write (row, enc, next) { rows.push(row); next() }
function end () {
t.deepEqual(rows, [
{ id: '/bar.js', deps: {} },
{ id: '/foo.js', deps: { './bar': '/bar.js' } },
{ id: '/main.js', deps: { './foo': '/foo.js' } }
]);
}
s.pipe(through.obj(write, end));
s.write({ id: '/main.js', deps: { './foo': '/foo.js' } });
s.write({ id: '/foo.js', deps: { './bar': '/bar.js' } });
s.write({ id: '/bar.js', deps: {} });
s.end();
});