Skip to content

Commit 2f7a13d

Browse files
committed
wip
1 parent 28bbf24 commit 2f7a13d

10 files changed

+895
-3403
lines changed

chompfile.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ deps = ['nodelibs/node', 'nodelibs/browser']
88

99
[[task]]
1010
target = 'nodelibs/browser'
11-
deps = ['src-browser/**/*']
11+
deps = ['src-browser/**/*', 'rollup.config.mjs']
1212
run = 'rollup -c'
13+
# env = { JSPM_GENERATOR_LOG = '1' }
1314

1415
[[task]]
1516
target = 'nodelibs/node'

package-lock.json

+874-3,376
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"devDependencies": {
99
"@jspm/plugin-rollup": "github:jspm/rollup-plugin-jspm#main",
1010
"@wasmer/wasi": "^0.12.0",
11-
"assert": "=2.0.0",
11+
"assert": "^2.1.0",
1212
"browserify-zlib": "^0.2.0",
1313
"buffer": "^6.0.3",
1414
"console-browserify": "^1.2.0",
@@ -27,8 +27,8 @@
2727
"path-browserify": "^1.0.1",
2828
"punycode": "^2.3.1",
2929
"querystring": "^0.2.1",
30+
"readable-stream": "^4.5.2",
3031
"rollup": "^4.20.0",
31-
"stream-browserify": "^3.0.0",
3232
"stream-http": "^3.2.0",
3333
"string_decoder": "^1.3.0",
3434
"timers-browserify": "^2.0.12",

rollup.config.mjs

+9-16
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import rollupPluginJspm from '@jspm/plugin-rollup';
2-
import { readdirSync } from 'fs';
2+
import { readFileSync, writeFileSync, readdirSync } from 'node:fs';
33
import rimraf from 'rimraf';
44

55
rimraf.sync('./nodelibs/browser');
66

7+
// Patch call-bind, pending https://github.com/ljharb/call-bind/pull/8.
8+
const callBindPath = './node_modules/call-bind/callBound.js';
9+
writeFileSync(callBindPath, readFileSync(callBindPath, 'utf8').replace('./', 'call-bind'));
10+
711
const input = Object.fromEntries(
812
[
913
...readdirSync('./src-browser'),
@@ -15,7 +19,7 @@ const input = Object.fromEntries(
1519
'stream/promises.js',
1620
'stream/web.js',
1721
'timers/promises.js',
18-
'util/types.js'
22+
'util/types.js',
1923
]
2024
.filter(n => !n.startsWith('__') && n.endsWith('.js'))
2125
.map(n => [n.slice(0, -3), './src-browser/' + n])
@@ -24,8 +28,6 @@ const input = Object.fromEntries(
2428
const jspmPlugin = rollupPluginJspm({
2529
env: ['browser'],
2630
inputMap: {
27-
// TODO: better way to override scopes?
28-
imports: input,
2931
scopes: {
3032
'./node_modules/assert/': input,
3133
'./node_modules/browserify-zlib/': input,
@@ -46,15 +48,14 @@ const jspmPlugin = rollupPluginJspm({
4648
'./node_modules/punycode/': input,
4749
'./node_modules/querystring/': input,
4850
'./node_modules/rollup/': input,
49-
'./node_modules/stream-browserify/': input,
51+
'./node_modules/readable-stream/': input,
5052
'./node_modules/stream-http/': input,
5153
'./node_modules/string_decoder/': input,
5254
'./node_modules/timers-browserify/': input,
5355
'./node_modules/tty-browserify/': input,
5456
'./node_modules/url/': input,
5557
'./node_modules/util/': input,
56-
'./node_modules/vm-browserify/': input
57-
58+
'./node_modules/vm-browserify/': input
5859
}
5960
}
6061
});
@@ -68,13 +69,5 @@ export default {
6869
format: 'esm'
6970
},
7071
onwarn () {},
71-
plugins: [jspmPlugin, {
72-
buildStart () {
73-
// (async () => {
74-
// for await (const { type, message } of jspmPlugin.logStream()) {
75-
// console.log(`${type}: ${message}`);
76-
// }
77-
// })();
78-
}
79-
}]
72+
plugins: [jspmPlugin]
8073
}

src-browser/_stream_duplex.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import stream from 'stream-browserify';
1+
import stream from './stream.js';
22
export default stream.Duplex;
33
export var from = stream.Duplex.from;

src-browser/_stream_passthrough.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
import stream from 'stream-browserify';
1+
import stream from './stream.js';
22
export default stream.PassThrough;

src-browser/_stream_transform.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
import stream from 'stream-browserify';
1+
import stream from './stream.js';
22
export default stream.Transform;

src-browser/_stream_writable.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import stream from 'stream-browserify';
1+
import stream from './stream.js';
22
export default stream.Writable;
33
export var WritableState = stream.Writable.WritableState;

src-browser/stream.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import stream from 'stream-browserify';
1+
import stream from 'readable-stream';
22
import { promisify } from './util.js';
33
export default stream;
44

@@ -23,4 +23,4 @@ export var Stream = stream.Stream;
2323
export const promises = {
2424
finished: promisify(stream.finished),
2525
pipeline: promisify(stream.pipeline)
26-
};
26+
}

src-browser/sys.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import util from 'util';
2-
export * from 'util';
1+
import util from './util.js';
2+
export * from './util.js';
33
export default util;

0 commit comments

Comments
 (0)