mirror of
https://github.com/JonasunderscoreJones/api-worker.git
synced 2025-10-23 02:19:19 +02:00
Initial commit (by create-cloudflare CLI)
This commit is contained in:
commit
58a42872a0
1745 changed files with 741893 additions and 0 deletions
2168
node_modules/@esbuild-plugins/node-globals-polyfill/Buffer.js
generated
vendored
Normal file
2168
node_modules/@esbuild-plugins/node-globals-polyfill/Buffer.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
node_modules/@esbuild-plugins/node-globals-polyfill/_buffer.js
generated
vendored
Normal file
1
node_modules/@esbuild-plugins/node-globals-polyfill/_buffer.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export { Buffer } from '_node-buffer-polyfill_.js'
|
1
node_modules/@esbuild-plugins/node-globals-polyfill/_process.js
generated
vendored
Normal file
1
node_modules/@esbuild-plugins/node-globals-polyfill/_process.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export { process } from '_node-process-polyfill_.js'
|
7
node_modules/@esbuild-plugins/node-globals-polyfill/dist/index.d.ts
generated
vendored
Normal file
7
node_modules/@esbuild-plugins/node-globals-polyfill/dist/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
import * as esbuild from 'esbuild';
|
||||
export declare function NodeGlobalsPolyfillPlugin({ buffer, process, }?: {
|
||||
buffer?: boolean | undefined;
|
||||
process?: boolean | undefined;
|
||||
}): esbuild.Plugin;
|
||||
export default NodeGlobalsPolyfillPlugin;
|
||||
//# sourceMappingURL=index.d.ts.map
|
1
node_modules/@esbuild-plugins/node-globals-polyfill/dist/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@esbuild-plugins/node-globals-polyfill/dist/index.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAElC,wBAAgB,yBAAyB,CAAC,EACtC,MAAc,EAEd,OAAc,GACjB;;;CAAK,GAAG,OAAO,CAAC,MAAM,CAyEtB;AAED,eAAe,yBAAyB,CAAA"}
|
80
node_modules/@esbuild-plugins/node-globals-polyfill/dist/index.js
generated
vendored
Normal file
80
node_modules/@esbuild-plugins/node-globals-polyfill/dist/index.js
generated
vendored
Normal file
|
@ -0,0 +1,80 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NodeGlobalsPolyfillPlugin = void 0;
|
||||
const path_1 = __importDefault(require("path"));
|
||||
function NodeGlobalsPolyfillPlugin({ buffer = false,
|
||||
// define = {},
|
||||
process = true, } = {}) {
|
||||
return {
|
||||
name: 'node-globals-polyfill',
|
||||
setup({ initialOptions, onResolve, onLoad }) {
|
||||
onResolve({ filter: /_node-buffer-polyfill_\.js/ }, (arg) => {
|
||||
return {
|
||||
path: path_1.default.resolve(__dirname, '../Buffer.js'),
|
||||
};
|
||||
});
|
||||
onResolve({ filter: /_node-process-polyfill_\.js/ }, (arg) => {
|
||||
return {
|
||||
path: path_1.default.resolve(__dirname, '../process.js'),
|
||||
};
|
||||
});
|
||||
// TODO esbuild cannot use virtual modules for inject: https://github.com/evanw/esbuild/issues/2762
|
||||
// onLoad({ filter: /_virtual-process-polyfill_\.js/ }, (arg) => {
|
||||
// const data = fs
|
||||
// .readFileSync(path.resolve(__dirname, '../process.js'))
|
||||
// .toString()
|
||||
// const keys = Object.keys(define)
|
||||
// return {
|
||||
// loader: 'js',
|
||||
// contents: data.replace(
|
||||
// `const defines = {}`,
|
||||
// 'const defines = {\n' +
|
||||
// keys
|
||||
// .filter((x) => x.startsWith('process.'))
|
||||
// .sort((a, b) => a.length - b.length)
|
||||
// .map(
|
||||
// (k) =>
|
||||
// ` ${JSON.stringify(k).replace(
|
||||
// 'process.',
|
||||
// '',
|
||||
// )}: ${define[k]},`,
|
||||
// )
|
||||
// .join('\n') +
|
||||
// '\n}',
|
||||
// ),
|
||||
// }
|
||||
// })
|
||||
onResolve({ filter: /_virtual-process-polyfill_\.js/ }, () => {
|
||||
return {
|
||||
path: path_1.default.resolve(__dirname, '../process.js'),
|
||||
};
|
||||
});
|
||||
onResolve({ filter: /_virtual-buffer-polyfill_\.js/ }, () => {
|
||||
return {
|
||||
path: path_1.default.resolve(__dirname, '../_buffer.js'),
|
||||
};
|
||||
});
|
||||
const polyfills = [];
|
||||
if (process) {
|
||||
polyfills.push(path_1.default.resolve(__dirname, '../_virtual-process-polyfill_.js'));
|
||||
}
|
||||
if (buffer) {
|
||||
polyfills.push(path_1.default.resolve(__dirname, '../_virtual-buffer-polyfill_.js'));
|
||||
}
|
||||
if (initialOptions.inject) {
|
||||
initialOptions.inject.push(...polyfills);
|
||||
// handle duplicate plugin
|
||||
initialOptions.inject = [...new Set(initialOptions.inject)];
|
||||
}
|
||||
else {
|
||||
initialOptions.inject = [...polyfills];
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
exports.NodeGlobalsPolyfillPlugin = NodeGlobalsPolyfillPlugin;
|
||||
exports.default = NodeGlobalsPolyfillPlugin;
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@esbuild-plugins/node-globals-polyfill/dist/index.js.map
generated
vendored
Normal file
1
node_modules/@esbuild-plugins/node-globals-polyfill/dist/index.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AAIvB,SAAgB,yBAAyB,CAAC,EACtC,MAAM,GAAG,KAAK;AACd,eAAe;AACf,OAAO,GAAG,IAAI,GACjB,GAAG,EAAE;IACF,OAAO;QACH,IAAI,EAAE,uBAAuB;QAC7B,KAAK,CAAC,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE;YACvC,SAAS,CAAC,EAAE,MAAM,EAAE,4BAA4B,EAAE,E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J;YACD,IAAI,MAAM,EAAE;gBACR,SAAS,CAAC,IAAI,CACV,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,iCAAiC,CAAC,CAC7D,CAAA;aACJ;YACD,IAAI,cAAc,CAAC,MAAM,EAAE;gBACvB,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAA;gBACxC,0BAA0B;gBAC1B,cAAc,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAA;aAC9D;iBAAM;gBACH,cAAc,CAAC,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC,CAAA;aACzC;QACL,CAAC;KACJ,CAAA;AACL,CAAC;AA7ED,8DA6EC;AAED,kBAAe,yBAAyB,CAAA"}
|
2
node_modules/@esbuild-plugins/node-globals-polyfill/dist/index.test.d.ts
generated
vendored
Normal file
2
node_modules/@esbuild-plugins/node-globals-polyfill/dist/index.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=index.test.d.ts.map
|
1
node_modules/@esbuild-plugins/node-globals-polyfill/dist/index.test.d.ts.map
generated
vendored
Normal file
1
node_modules/@esbuild-plugins/node-globals-polyfill/dist/index.test.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":""}
|
139
node_modules/@esbuild-plugins/node-globals-polyfill/dist/index.test.js
generated
vendored
Normal file
139
node_modules/@esbuild-plugins/node-globals-polyfill/dist/index.test.js
generated
vendored
Normal file
|
@ -0,0 +1,139 @@
|
|||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const esbuild_1 = require("esbuild");
|
||||
const test_support_1 = require("test-support");
|
||||
const _1 = require(".");
|
||||
require('debug').enable(require('../package.json').name);
|
||||
test('process works', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield test_support_1.writeFiles({
|
||||
'entry.ts': `process.version`,
|
||||
});
|
||||
const res = yield esbuild_1.build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
inject: [require.resolve('../process')],
|
||||
});
|
||||
const output = res.outputFiles[0].text;
|
||||
// console.log(output)
|
||||
eval(output);
|
||||
unlink();
|
||||
}));
|
||||
test('process is tree shaken', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield test_support_1.writeFiles({
|
||||
'entry.ts': `console.log('hei')`,
|
||||
});
|
||||
const res = yield esbuild_1.build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
inject: [require.resolve('../process')],
|
||||
});
|
||||
const output = res.outputFiles[0].text;
|
||||
expect(output).not.toContain('process');
|
||||
unlink();
|
||||
}));
|
||||
// TODO esbuild cannot use virtual modules for inject: https://github.com/evanw/esbuild/issues/2762
|
||||
test('process env vars are replaced with ones from define', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield test_support_1.writeFiles({
|
||||
'entry.ts': `if (process.env.VAR !== 'hello') { throw new Error('process.env.VAR not right: ' + process.env.VAR) }`,
|
||||
});
|
||||
const res = yield esbuild_1.build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
define: {
|
||||
'process.env.VAR': '"hello"',
|
||||
},
|
||||
plugins: [_1.NodeGlobalsPolyfillPlugin({})],
|
||||
});
|
||||
const output = res.outputFiles[0].text;
|
||||
eval(output);
|
||||
unlink();
|
||||
}));
|
||||
test('Buffer works', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield test_support_1.writeFiles({
|
||||
'entry.ts': `console.log(Buffer.from('xxx').toString())`,
|
||||
});
|
||||
const res = yield esbuild_1.build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
inject: [require.resolve('../Buffer')],
|
||||
});
|
||||
const output = res.outputFiles[0].text;
|
||||
// console.log(output)
|
||||
eval(output);
|
||||
unlink();
|
||||
}));
|
||||
test('Buffer is tree shaken', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield test_support_1.writeFiles({
|
||||
'entry.ts': `console.log('hei')`,
|
||||
});
|
||||
const res = yield esbuild_1.build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
inject: [require.resolve('../Buffer')],
|
||||
});
|
||||
const output = res.outputFiles[0].text;
|
||||
expect(output).not.toContain('Buffer');
|
||||
unlink();
|
||||
}));
|
||||
test('Buffer works using plugin', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield test_support_1.writeFiles({
|
||||
'entry.ts': `
|
||||
let buf = new Buffer(256);
|
||||
let len = buf.write("Simply Easy Learning");
|
||||
console.log("Octets written : "+ len);`,
|
||||
});
|
||||
const res = yield esbuild_1.build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [_1.NodeGlobalsPolyfillPlugin({ buffer: true })],
|
||||
});
|
||||
const output = res.outputFiles[0].text;
|
||||
// console.log(output)
|
||||
eval(output);
|
||||
unlink();
|
||||
}));
|
||||
test('process works using plugin', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield test_support_1.writeFiles({
|
||||
'entry.ts': `console.log(process.cwd())`,
|
||||
});
|
||||
const res = yield esbuild_1.build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [_1.NodeGlobalsPolyfillPlugin({ process: true })],
|
||||
});
|
||||
const output = res.outputFiles[0].text;
|
||||
// console.log(output)
|
||||
eval(output);
|
||||
unlink();
|
||||
}));
|
||||
//# sourceMappingURL=index.test.js.map
|
1
node_modules/@esbuild-plugins/node-globals-polyfill/dist/index.test.js.map
generated
vendored
Normal file
1
node_modules/@esbuild-plugins/node-globals-polyfill/dist/index.test.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,qCAA+B;AAC/B,+CAAyC;AACzC,wBAA6C;AAE7C,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,CAAA;AAExD,IAAI,CAAC,eAAe,EAAE,GAAS,EAAE;IAC7B,MAAM,EACF,MAAM,EACN,KAAK,EAAE,CAAC,KAAK,CAAC,GACjB,GAAG,MAAM,yBAAU,CAAC;QACjB,UAAU,EAAE,iBAAiB;KAChC,CAAC,CAAA;IACF,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC;QACpB,WAAW,EAAE,CAAC,KAAK,CAAC;QACpB,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,KAAK;QACb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ACF,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC;QACpB,WAAW,EAAE,CAAC,KAAK,CAAC;QACpB,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,CAAC,4BAAyB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;KAC1D,CAAC,CAAA;IACF,MAAM,MAAM,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACtC,sBAAsB;IACtB,IAAI,CAAC,MAAM,CAAC,CAAA;IACZ,MAAM,EAAE,CAAA;AACZ,CAAC,CAAA,CAAC,CAAA"}
|
7
node_modules/@esbuild-plugins/node-globals-polyfill/esm/index.d.ts
generated
vendored
Normal file
7
node_modules/@esbuild-plugins/node-globals-polyfill/esm/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
import * as esbuild from 'esbuild';
|
||||
export declare function NodeGlobalsPolyfillPlugin({ buffer, process, }?: {
|
||||
buffer?: boolean | undefined;
|
||||
process?: boolean | undefined;
|
||||
}): esbuild.Plugin;
|
||||
export default NodeGlobalsPolyfillPlugin;
|
||||
//# sourceMappingURL=index.d.ts.map
|
1
node_modules/@esbuild-plugins/node-globals-polyfill/esm/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@esbuild-plugins/node-globals-polyfill/esm/index.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAElC,wBAAgB,yBAAyB,CAAC,EACtC,MAAc,EAEd,OAAc,GACjB;;;CAAK,GAAG,OAAO,CAAC,MAAM,CAyEtB;AAED,eAAe,yBAAyB,CAAA"}
|
73
node_modules/@esbuild-plugins/node-globals-polyfill/esm/index.js
generated
vendored
Normal file
73
node_modules/@esbuild-plugins/node-globals-polyfill/esm/index.js
generated
vendored
Normal file
|
@ -0,0 +1,73 @@
|
|||
import path from 'path';
|
||||
export function NodeGlobalsPolyfillPlugin({ buffer = false,
|
||||
// define = {},
|
||||
process = true, } = {}) {
|
||||
return {
|
||||
name: 'node-globals-polyfill',
|
||||
setup({ initialOptions, onResolve, onLoad }) {
|
||||
onResolve({ filter: /_node-buffer-polyfill_\.js/ }, (arg) => {
|
||||
return {
|
||||
path: path.resolve(__dirname, '../Buffer.js'),
|
||||
};
|
||||
});
|
||||
onResolve({ filter: /_node-process-polyfill_\.js/ }, (arg) => {
|
||||
return {
|
||||
path: path.resolve(__dirname, '../process.js'),
|
||||
};
|
||||
});
|
||||
// TODO esbuild cannot use virtual modules for inject: https://github.com/evanw/esbuild/issues/2762
|
||||
// onLoad({ filter: /_virtual-process-polyfill_\.js/ }, (arg) => {
|
||||
// const data = fs
|
||||
// .readFileSync(path.resolve(__dirname, '../process.js'))
|
||||
// .toString()
|
||||
// const keys = Object.keys(define)
|
||||
// return {
|
||||
// loader: 'js',
|
||||
// contents: data.replace(
|
||||
// `const defines = {}`,
|
||||
// 'const defines = {\n' +
|
||||
// keys
|
||||
// .filter((x) => x.startsWith('process.'))
|
||||
// .sort((a, b) => a.length - b.length)
|
||||
// .map(
|
||||
// (k) =>
|
||||
// ` ${JSON.stringify(k).replace(
|
||||
// 'process.',
|
||||
// '',
|
||||
// )}: ${define[k]},`,
|
||||
// )
|
||||
// .join('\n') +
|
||||
// '\n}',
|
||||
// ),
|
||||
// }
|
||||
// })
|
||||
onResolve({ filter: /_virtual-process-polyfill_\.js/ }, () => {
|
||||
return {
|
||||
path: path.resolve(__dirname, '../process.js'),
|
||||
};
|
||||
});
|
||||
onResolve({ filter: /_virtual-buffer-polyfill_\.js/ }, () => {
|
||||
return {
|
||||
path: path.resolve(__dirname, '../_buffer.js'),
|
||||
};
|
||||
});
|
||||
const polyfills = [];
|
||||
if (process) {
|
||||
polyfills.push(path.resolve(__dirname, '../_virtual-process-polyfill_.js'));
|
||||
}
|
||||
if (buffer) {
|
||||
polyfills.push(path.resolve(__dirname, '../_virtual-buffer-polyfill_.js'));
|
||||
}
|
||||
if (initialOptions.inject) {
|
||||
initialOptions.inject.push(...polyfills);
|
||||
// handle duplicate plugin
|
||||
initialOptions.inject = [...new Set(initialOptions.inject)];
|
||||
}
|
||||
else {
|
||||
initialOptions.inject = [...polyfills];
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
export default NodeGlobalsPolyfillPlugin;
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@esbuild-plugins/node-globals-polyfill/esm/index.js.map
generated
vendored
Normal file
1
node_modules/@esbuild-plugins/node-globals-polyfill/esm/index.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AAIvB,MAAM,UAAU,yBAAyB,CAAC,EACtC,MAAM,GAAG,KAAK;AACd,eAAe;AACf,OAAO,GAAG,IAAI,GACjB,GAAG,EAAE;IACF,OAAO;QACH,IAAI,EAAE,uBAAuB;QAC7B,KAAK,CAAC,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE;YACvC,SAAS,CAAC,EAAE,MAAM,EAAE,4BAA4B,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE;gBACxD,OAAO;oBACH,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC;iBAChD,CAAA;YACL,CAAC,CAAC,CAAA;YACF,SAAS,CAAC,EAAE,MAAM,EAAE,6BAA6B,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE;gBACzD,OAAO;oBACH,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,eAAe,CAAC;iBACjD,CAAA;YACL,CAAC,CAAC,CAAA;YAEF,mGAAmG;YACnG,kEAAkE;YAClE,sB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AM,GAAG,CAAC,GAAG,SAAS,CAAC,CAAA;aACzC;QACL,CAAC;KACJ,CAAA;AACL,CAAC;AAED,eAAe,yBAAyB,CAAA"}
|
2
node_modules/@esbuild-plugins/node-globals-polyfill/esm/index.test.d.ts
generated
vendored
Normal file
2
node_modules/@esbuild-plugins/node-globals-polyfill/esm/index.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=index.test.d.ts.map
|
1
node_modules/@esbuild-plugins/node-globals-polyfill/esm/index.test.d.ts.map
generated
vendored
Normal file
1
node_modules/@esbuild-plugins/node-globals-polyfill/esm/index.test.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":""}
|
137
node_modules/@esbuild-plugins/node-globals-polyfill/esm/index.test.js
generated
vendored
Normal file
137
node_modules/@esbuild-plugins/node-globals-polyfill/esm/index.test.js
generated
vendored
Normal file
|
@ -0,0 +1,137 @@
|
|||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
import { build } from 'esbuild';
|
||||
import { writeFiles } from 'test-support';
|
||||
import { NodeGlobalsPolyfillPlugin } from '.';
|
||||
require('debug').enable(require('../package.json').name);
|
||||
test('process works', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield writeFiles({
|
||||
'entry.ts': `process.version`,
|
||||
});
|
||||
const res = yield build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
inject: [require.resolve('../process')],
|
||||
});
|
||||
const output = res.outputFiles[0].text;
|
||||
// console.log(output)
|
||||
eval(output);
|
||||
unlink();
|
||||
}));
|
||||
test('process is tree shaken', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield writeFiles({
|
||||
'entry.ts': `console.log('hei')`,
|
||||
});
|
||||
const res = yield build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
inject: [require.resolve('../process')],
|
||||
});
|
||||
const output = res.outputFiles[0].text;
|
||||
expect(output).not.toContain('process');
|
||||
unlink();
|
||||
}));
|
||||
// TODO esbuild cannot use virtual modules for inject: https://github.com/evanw/esbuild/issues/2762
|
||||
test('process env vars are replaced with ones from define', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield writeFiles({
|
||||
'entry.ts': `if (process.env.VAR !== 'hello') { throw new Error('process.env.VAR not right: ' + process.env.VAR) }`,
|
||||
});
|
||||
const res = yield build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
define: {
|
||||
'process.env.VAR': '"hello"',
|
||||
},
|
||||
plugins: [NodeGlobalsPolyfillPlugin({})],
|
||||
});
|
||||
const output = res.outputFiles[0].text;
|
||||
eval(output);
|
||||
unlink();
|
||||
}));
|
||||
test('Buffer works', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield writeFiles({
|
||||
'entry.ts': `console.log(Buffer.from('xxx').toString())`,
|
||||
});
|
||||
const res = yield build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
inject: [require.resolve('../Buffer')],
|
||||
});
|
||||
const output = res.outputFiles[0].text;
|
||||
// console.log(output)
|
||||
eval(output);
|
||||
unlink();
|
||||
}));
|
||||
test('Buffer is tree shaken', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield writeFiles({
|
||||
'entry.ts': `console.log('hei')`,
|
||||
});
|
||||
const res = yield build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
inject: [require.resolve('../Buffer')],
|
||||
});
|
||||
const output = res.outputFiles[0].text;
|
||||
expect(output).not.toContain('Buffer');
|
||||
unlink();
|
||||
}));
|
||||
test('Buffer works using plugin', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield writeFiles({
|
||||
'entry.ts': `
|
||||
let buf = new Buffer(256);
|
||||
let len = buf.write("Simply Easy Learning");
|
||||
console.log("Octets written : "+ len);`,
|
||||
});
|
||||
const res = yield build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [NodeGlobalsPolyfillPlugin({ buffer: true })],
|
||||
});
|
||||
const output = res.outputFiles[0].text;
|
||||
// console.log(output)
|
||||
eval(output);
|
||||
unlink();
|
||||
}));
|
||||
test('process works using plugin', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield writeFiles({
|
||||
'entry.ts': `console.log(process.cwd())`,
|
||||
});
|
||||
const res = yield build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [NodeGlobalsPolyfillPlugin({ process: true })],
|
||||
});
|
||||
const output = res.outputFiles[0].text;
|
||||
// console.log(output)
|
||||
eval(output);
|
||||
unlink();
|
||||
}));
|
||||
//# sourceMappingURL=index.test.js.map
|
1
node_modules/@esbuild-plugins/node-globals-polyfill/esm/index.test.js.map
generated
vendored
Normal file
1
node_modules/@esbuild-plugins/node-globals-polyfill/esm/index.test.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,GAAG,CAAA;AAE7C,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,CAAA;AAExD,IAAI,CAAC,eAAe,EAAE,GAAS,EAAE;IAC7B,MAAM,EACF,MAAM,EACN,KAAK,EAAE,CAAC,KAAK,CAAC,GACjB,GAAG,MAAM,UAAU,CAAC;QACjB,UAAU,EAAE,iBAAiB;KAChC,CAAC,CAAA;IACF,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC;QACpB,WAAW,EAAE,CAAC,KAAK,CAAC;QACpB,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;KAC1C,CAAC,CAAA;IACF,MAAM,MAAM,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACtC,sBAAsB;IACtB,IAAI,CAAC,MAAM,CAAC,CAAA;IACZ,MAAM,EAAE,CAAA;AACZ,CAAC,CAAA,CAAC,CAAA;AAEF,IAAI,CAAC,wBAAwB,EAAE,GAAS,EAAE;IACtC,MAAM,EACF,MAAM,EACN,KAAK,EAAE,CAAC,KAAK,CAAC,GACjB,GAAG,MAAM,UAAU,CAAC;QACj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
|
34
node_modules/@esbuild-plugins/node-globals-polyfill/package.json
generated
vendored
Normal file
34
node_modules/@esbuild-plugins/node-globals-polyfill/package.json
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"name": "@esbuild-plugins/node-globals-polyfill",
|
||||
"version": "0.2.3",
|
||||
"description": "",
|
||||
"preferUnplugged": true,
|
||||
"sideEffects": false,
|
||||
"main": "dist/index.js",
|
||||
"module": "esm/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"repository": "https://github.com/remorses/esbuild-plugins.git",
|
||||
"scripts": {
|
||||
"build": "tsc && tsc -m es6 --outDir esm",
|
||||
"watch": "tsc -w"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"src",
|
||||
"esm",
|
||||
"Buffer.js",
|
||||
"process.js",
|
||||
"_buffer.js",
|
||||
"_process.js"
|
||||
],
|
||||
"keywords": [],
|
||||
"author": "Tommaso De Rossi, morse <beats.by.morse@gmail.com>",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"test-support": "*"
|
||||
},
|
||||
"dependencies": {},
|
||||
"peerDependencies": {
|
||||
"esbuild": "*"
|
||||
}
|
||||
}
|
245
node_modules/@esbuild-plugins/node-globals-polyfill/process.js
generated
vendored
Normal file
245
node_modules/@esbuild-plugins/node-globals-polyfill/process.js
generated
vendored
Normal file
|
@ -0,0 +1,245 @@
|
|||
// shim for using process in browser
|
||||
// based off https://github.com/defunctzombie/node-process/blob/master/browser.js
|
||||
|
||||
function defaultSetTimout() {
|
||||
throw new Error('setTimeout has not been defined')
|
||||
}
|
||||
function defaultClearTimeout() {
|
||||
throw new Error('clearTimeout has not been defined')
|
||||
}
|
||||
var cachedSetTimeout = defaultSetTimout
|
||||
var cachedClearTimeout = defaultClearTimeout
|
||||
if (typeof global.setTimeout === 'function') {
|
||||
cachedSetTimeout = setTimeout
|
||||
}
|
||||
if (typeof global.clearTimeout === 'function') {
|
||||
cachedClearTimeout = clearTimeout
|
||||
}
|
||||
|
||||
function runTimeout(fun) {
|
||||
if (cachedSetTimeout === setTimeout) {
|
||||
//normal enviroments in sane situations
|
||||
return setTimeout(fun, 0)
|
||||
}
|
||||
// if setTimeout wasn't available but was latter defined
|
||||
if (
|
||||
(cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) &&
|
||||
setTimeout
|
||||
) {
|
||||
cachedSetTimeout = setTimeout
|
||||
return setTimeout(fun, 0)
|
||||
}
|
||||
try {
|
||||
// when when somebody has screwed with setTimeout but no I.E. maddness
|
||||
return cachedSetTimeout(fun, 0)
|
||||
} catch (e) {
|
||||
try {
|
||||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
||||
return cachedSetTimeout.call(null, fun, 0)
|
||||
} catch (e) {
|
||||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
||||
return cachedSetTimeout.call(this, fun, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
function runClearTimeout(marker) {
|
||||
if (cachedClearTimeout === clearTimeout) {
|
||||
//normal enviroments in sane situations
|
||||
return clearTimeout(marker)
|
||||
}
|
||||
// if clearTimeout wasn't available but was latter defined
|
||||
if (
|
||||
(cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) &&
|
||||
clearTimeout
|
||||
) {
|
||||
cachedClearTimeout = clearTimeout
|
||||
return clearTimeout(marker)
|
||||
}
|
||||
try {
|
||||
// when when somebody has screwed with setTimeout but no I.E. maddness
|
||||
return cachedClearTimeout(marker)
|
||||
} catch (e) {
|
||||
try {
|
||||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
||||
return cachedClearTimeout.call(null, marker)
|
||||
} catch (e) {
|
||||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
||||
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
||||
return cachedClearTimeout.call(this, marker)
|
||||
}
|
||||
}
|
||||
}
|
||||
var queue = []
|
||||
var draining = false
|
||||
var currentQueue
|
||||
var queueIndex = -1
|
||||
|
||||
function cleanUpNextTick() {
|
||||
if (!draining || !currentQueue) {
|
||||
return
|
||||
}
|
||||
draining = false
|
||||
if (currentQueue.length) {
|
||||
queue = currentQueue.concat(queue)
|
||||
} else {
|
||||
queueIndex = -1
|
||||
}
|
||||
if (queue.length) {
|
||||
drainQueue()
|
||||
}
|
||||
}
|
||||
|
||||
function drainQueue() {
|
||||
if (draining) {
|
||||
return
|
||||
}
|
||||
var timeout = runTimeout(cleanUpNextTick)
|
||||
draining = true
|
||||
|
||||
var len = queue.length
|
||||
while (len) {
|
||||
currentQueue = queue
|
||||
queue = []
|
||||
while (++queueIndex < len) {
|
||||
if (currentQueue) {
|
||||
currentQueue[queueIndex].run()
|
||||
}
|
||||
}
|
||||
queueIndex = -1
|
||||
len = queue.length
|
||||
}
|
||||
currentQueue = null
|
||||
draining = false
|
||||
runClearTimeout(timeout)
|
||||
}
|
||||
function nextTick(fun) {
|
||||
var args = new Array(arguments.length - 1)
|
||||
if (arguments.length > 1) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
args[i - 1] = arguments[i]
|
||||
}
|
||||
}
|
||||
queue.push(new Item(fun, args))
|
||||
if (queue.length === 1 && !draining) {
|
||||
runTimeout(drainQueue)
|
||||
}
|
||||
}
|
||||
// v8 likes predictible objects
|
||||
function Item(fun, array) {
|
||||
this.fun = fun
|
||||
this.array = array
|
||||
}
|
||||
Item.prototype.run = function() {
|
||||
this.fun.apply(null, this.array)
|
||||
}
|
||||
var title = 'browser'
|
||||
var platform = 'browser'
|
||||
var browser = true
|
||||
var env = {}
|
||||
var argv = []
|
||||
var version = '' // empty string to avoid regexp issues
|
||||
var versions = {}
|
||||
var release = {}
|
||||
var config = {}
|
||||
|
||||
function noop() {}
|
||||
|
||||
var on = noop
|
||||
var addListener = noop
|
||||
var once = noop
|
||||
var off = noop
|
||||
var removeListener = noop
|
||||
var removeAllListeners = noop
|
||||
var emit = noop
|
||||
|
||||
function binding(name) {
|
||||
throw new Error('process.binding is not supported')
|
||||
}
|
||||
|
||||
function cwd() {
|
||||
return '/'
|
||||
}
|
||||
function chdir(dir) {
|
||||
throw new Error('process.chdir is not supported')
|
||||
}
|
||||
function umask() {
|
||||
return 0
|
||||
}
|
||||
|
||||
// from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
|
||||
var performance = global.performance || {}
|
||||
var performanceNow =
|
||||
performance.now ||
|
||||
performance.mozNow ||
|
||||
performance.msNow ||
|
||||
performance.oNow ||
|
||||
performance.webkitNow ||
|
||||
function() {
|
||||
return new Date().getTime()
|
||||
}
|
||||
|
||||
// generate timestamp or delta
|
||||
// see http://nodejs.org/api/process.html#process_process_hrtime
|
||||
function hrtime(previousTimestamp) {
|
||||
var clocktime = performanceNow.call(performance) * 1e-3
|
||||
var seconds = Math.floor(clocktime)
|
||||
var nanoseconds = Math.floor((clocktime % 1) * 1e9)
|
||||
if (previousTimestamp) {
|
||||
seconds = seconds - previousTimestamp[0]
|
||||
nanoseconds = nanoseconds - previousTimestamp[1]
|
||||
if (nanoseconds < 0) {
|
||||
seconds--
|
||||
nanoseconds += 1e9
|
||||
}
|
||||
}
|
||||
return [seconds, nanoseconds]
|
||||
}
|
||||
|
||||
var startTime = new Date()
|
||||
function uptime() {
|
||||
var currentTime = new Date()
|
||||
var dif = currentTime - startTime
|
||||
return dif / 1000
|
||||
}
|
||||
|
||||
export var process = {
|
||||
nextTick: nextTick,
|
||||
title: title,
|
||||
browser: browser,
|
||||
env: env,
|
||||
argv: argv,
|
||||
version: version,
|
||||
versions: versions,
|
||||
on: on,
|
||||
addListener: addListener,
|
||||
once: once,
|
||||
off: off,
|
||||
removeListener: removeListener,
|
||||
removeAllListeners: removeAllListeners,
|
||||
emit: emit,
|
||||
binding: binding,
|
||||
cwd: cwd,
|
||||
chdir: chdir,
|
||||
umask: umask,
|
||||
hrtime: hrtime,
|
||||
platform: platform,
|
||||
release: release,
|
||||
config: config,
|
||||
uptime: uptime,
|
||||
}
|
||||
|
||||
// replace process.env.VAR with define
|
||||
|
||||
const defines = {}
|
||||
Object.keys(defines).forEach((key) => {
|
||||
const segs = key.split('.')
|
||||
let target = process
|
||||
for (let i = 0; i < segs.length; i++) {
|
||||
const seg = segs[i]
|
||||
if (i === segs.length - 1) {
|
||||
target[seg] = defines[key]
|
||||
} else {
|
||||
target = target[seg] || (target[seg] = {})
|
||||
}
|
||||
}
|
||||
})
|
155
node_modules/@esbuild-plugins/node-globals-polyfill/src/index.test.ts
generated
vendored
Normal file
155
node_modules/@esbuild-plugins/node-globals-polyfill/src/index.test.ts
generated
vendored
Normal file
|
@ -0,0 +1,155 @@
|
|||
import { build } from 'esbuild'
|
||||
import { writeFiles } from 'test-support'
|
||||
import { NodeGlobalsPolyfillPlugin } from '.'
|
||||
|
||||
require('debug').enable(require('../package.json').name)
|
||||
|
||||
test('process works', async () => {
|
||||
const {
|
||||
unlink,
|
||||
paths: [ENTRY],
|
||||
} = await writeFiles({
|
||||
'entry.ts': `process.version`,
|
||||
})
|
||||
const res = await build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
inject: [require.resolve('../process')],
|
||||
})
|
||||
const output = res.outputFiles[0].text
|
||||
// console.log(output)
|
||||
eval(output)
|
||||
unlink()
|
||||
})
|
||||
|
||||
test('process is tree shaken', async () => {
|
||||
const {
|
||||
unlink,
|
||||
paths: [ENTRY],
|
||||
} = await writeFiles({
|
||||
'entry.ts': `console.log('hei')`,
|
||||
})
|
||||
const res = await build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
inject: [require.resolve('../process')],
|
||||
})
|
||||
const output = res.outputFiles[0].text
|
||||
expect(output).not.toContain('process')
|
||||
unlink()
|
||||
})
|
||||
|
||||
// TODO esbuild cannot use virtual modules for inject: https://github.com/evanw/esbuild/issues/2762
|
||||
test('process env vars are replaced with ones from define', async () => {
|
||||
const {
|
||||
unlink,
|
||||
paths: [ENTRY],
|
||||
} = await writeFiles({
|
||||
'entry.ts': `if (process.env.VAR !== 'hello') { throw new Error('process.env.VAR not right: ' + process.env.VAR) }`,
|
||||
})
|
||||
const res = await build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
define: {
|
||||
'process.env.VAR': '"hello"',
|
||||
},
|
||||
plugins: [NodeGlobalsPolyfillPlugin({})],
|
||||
})
|
||||
const output = res.outputFiles[0].text
|
||||
eval(output)
|
||||
unlink()
|
||||
})
|
||||
|
||||
test('Buffer works', async () => {
|
||||
const {
|
||||
unlink,
|
||||
paths: [ENTRY],
|
||||
} = await writeFiles({
|
||||
'entry.ts': `console.log(Buffer.from('xxx').toString())`,
|
||||
})
|
||||
const res = await build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
inject: [require.resolve('../Buffer')],
|
||||
})
|
||||
const output = res.outputFiles[0].text
|
||||
// console.log(output)
|
||||
eval(output)
|
||||
unlink()
|
||||
})
|
||||
|
||||
test('Buffer is tree shaken', async () => {
|
||||
const {
|
||||
unlink,
|
||||
paths: [ENTRY],
|
||||
} = await writeFiles({
|
||||
'entry.ts': `console.log('hei')`,
|
||||
})
|
||||
const res = await build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
inject: [require.resolve('../Buffer')],
|
||||
})
|
||||
const output = res.outputFiles[0].text
|
||||
expect(output).not.toContain('Buffer')
|
||||
unlink()
|
||||
})
|
||||
|
||||
test('Buffer works using plugin', async () => {
|
||||
const {
|
||||
unlink,
|
||||
paths: [ENTRY],
|
||||
} = await writeFiles({
|
||||
'entry.ts': `
|
||||
let buf = new Buffer(256);
|
||||
let len = buf.write("Simply Easy Learning");
|
||||
console.log("Octets written : "+ len);`,
|
||||
})
|
||||
const res = await build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [NodeGlobalsPolyfillPlugin({ buffer: true })],
|
||||
})
|
||||
const output = res.outputFiles[0].text
|
||||
// console.log(output)
|
||||
eval(output)
|
||||
unlink()
|
||||
})
|
||||
test('process works using plugin', async () => {
|
||||
const {
|
||||
unlink,
|
||||
paths: [ENTRY],
|
||||
} = await writeFiles({
|
||||
'entry.ts': `console.log(process.cwd())`,
|
||||
})
|
||||
const res = await build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [NodeGlobalsPolyfillPlugin({ process: true })],
|
||||
})
|
||||
const output = res.outputFiles[0].text
|
||||
// console.log(output)
|
||||
eval(output)
|
||||
unlink()
|
||||
})
|
84
node_modules/@esbuild-plugins/node-globals-polyfill/src/index.ts
generated
vendored
Normal file
84
node_modules/@esbuild-plugins/node-globals-polyfill/src/index.ts
generated
vendored
Normal file
|
@ -0,0 +1,84 @@
|
|||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
import * as esbuild from 'esbuild'
|
||||
|
||||
export function NodeGlobalsPolyfillPlugin({
|
||||
buffer = false,
|
||||
// define = {},
|
||||
process = true,
|
||||
} = {}): esbuild.Plugin {
|
||||
return {
|
||||
name: 'node-globals-polyfill',
|
||||
setup({ initialOptions, onResolve, onLoad }) {
|
||||
onResolve({ filter: /_node-buffer-polyfill_\.js/ }, (arg) => {
|
||||
return {
|
||||
path: path.resolve(__dirname, '../Buffer.js'),
|
||||
}
|
||||
})
|
||||
onResolve({ filter: /_node-process-polyfill_\.js/ }, (arg) => {
|
||||
return {
|
||||
path: path.resolve(__dirname, '../process.js'),
|
||||
}
|
||||
})
|
||||
|
||||
// TODO esbuild cannot use virtual modules for inject: https://github.com/evanw/esbuild/issues/2762
|
||||
// onLoad({ filter: /_virtual-process-polyfill_\.js/ }, (arg) => {
|
||||
// const data = fs
|
||||
// .readFileSync(path.resolve(__dirname, '../process.js'))
|
||||
// .toString()
|
||||
|
||||
// const keys = Object.keys(define)
|
||||
// return {
|
||||
// loader: 'js',
|
||||
// contents: data.replace(
|
||||
// `const defines = {}`,
|
||||
// 'const defines = {\n' +
|
||||
// keys
|
||||
// .filter((x) => x.startsWith('process.'))
|
||||
// .sort((a, b) => a.length - b.length)
|
||||
// .map(
|
||||
// (k) =>
|
||||
// ` ${JSON.stringify(k).replace(
|
||||
// 'process.',
|
||||
// '',
|
||||
// )}: ${define[k]},`,
|
||||
// )
|
||||
// .join('\n') +
|
||||
// '\n}',
|
||||
// ),
|
||||
// }
|
||||
// })
|
||||
onResolve({ filter: /_virtual-process-polyfill_\.js/ }, () => {
|
||||
return {
|
||||
path: path.resolve(__dirname, '../process.js'),
|
||||
}
|
||||
})
|
||||
onResolve({ filter: /_virtual-buffer-polyfill_\.js/ }, () => {
|
||||
return {
|
||||
path: path.resolve(__dirname, '../_buffer.js'),
|
||||
}
|
||||
})
|
||||
|
||||
const polyfills: string[] = []
|
||||
if (process) {
|
||||
polyfills.push(
|
||||
path.resolve(__dirname, '../_virtual-process-polyfill_.js'),
|
||||
)
|
||||
}
|
||||
if (buffer) {
|
||||
polyfills.push(
|
||||
path.resolve(__dirname, '../_virtual-buffer-polyfill_.js'),
|
||||
)
|
||||
}
|
||||
if (initialOptions.inject) {
|
||||
initialOptions.inject.push(...polyfills)
|
||||
// handle duplicate plugin
|
||||
initialOptions.inject = [...new Set(initialOptions.inject)]
|
||||
} else {
|
||||
initialOptions.inject = [...polyfills]
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export default NodeGlobalsPolyfillPlugin
|
8
node_modules/@esbuild-plugins/node-modules-polyfill/dist/index.d.ts
generated
vendored
Normal file
8
node_modules/@esbuild-plugins/node-modules-polyfill/dist/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
import { Plugin } from 'esbuild';
|
||||
export interface NodePolyfillsOptions {
|
||||
name?: string;
|
||||
namespace?: string;
|
||||
}
|
||||
export declare function NodeModulesPolyfillPlugin(options?: NodePolyfillsOptions): Plugin;
|
||||
export default NodeModulesPolyfillPlugin;
|
||||
//# sourceMappingURL=index.d.ts.map
|
1
node_modules/@esbuild-plugins/node-modules-polyfill/dist/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@esbuild-plugins/node-modules-polyfill/dist/index.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,EAAE,MAAM,SAAS,CAAA;AAkB/C,MAAM,WAAW,oBAAoB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,wBAAgB,yBAAyB,CACrC,OAAO,GAAE,oBAAyB,GACnC,MAAM,CAwFR;AAmBD,eAAe,yBAAyB,CAAA"}
|
127
node_modules/@esbuild-plugins/node-modules-polyfill/dist/index.js
generated
vendored
Normal file
127
node_modules/@esbuild-plugins/node-modules-polyfill/dist/index.js
generated
vendored
Normal file
|
@ -0,0 +1,127 @@
|
|||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.NodeModulesPolyfillPlugin = void 0;
|
||||
const escape_string_regexp_1 = __importDefault(require("escape-string-regexp"));
|
||||
const fs_1 = __importDefault(require("fs"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const polyfills_1 = require("./polyfills");
|
||||
// import { NodeResolvePlugin } from '@esbuild-plugins/node-resolve'
|
||||
const NAME = 'node-modules-polyfills';
|
||||
const NAMESPACE = NAME;
|
||||
function removeEndingSlash(importee) {
|
||||
if (importee && importee.slice(-1) === '/') {
|
||||
importee = importee.slice(0, -1);
|
||||
}
|
||||
return importee;
|
||||
}
|
||||
function NodeModulesPolyfillPlugin(options = {}) {
|
||||
const { namespace = NAMESPACE, name = NAME } = options;
|
||||
if (namespace.endsWith('commonjs')) {
|
||||
throw new Error(`namespace ${namespace} must not end with commonjs`);
|
||||
}
|
||||
// this namespace is needed to make ES modules expose their default export to require: require('assert') will give you import('assert').default
|
||||
const commonjsNamespace = namespace + '-commonjs';
|
||||
const polyfilledBuiltins = polyfills_1.builtinsPolyfills();
|
||||
const polyfilledBuiltinsNames = [...polyfilledBuiltins.keys()];
|
||||
return {
|
||||
name,
|
||||
setup: function setup({ onLoad, onResolve, initialOptions }) {
|
||||
var _a;
|
||||
// polyfills contain global keyword, it must be defined
|
||||
if ((initialOptions === null || initialOptions === void 0 ? void 0 : initialOptions.define) && !((_a = initialOptions.define) === null || _a === void 0 ? void 0 : _a.global)) {
|
||||
initialOptions.define['global'] = 'globalThis';
|
||||
}
|
||||
else if (!(initialOptions === null || initialOptions === void 0 ? void 0 : initialOptions.define)) {
|
||||
initialOptions.define = { global: 'globalThis' };
|
||||
}
|
||||
// TODO these polyfill module cannot import anything, is that ok?
|
||||
function loader(args) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const argsPath = args.path.replace(/^node:/, '');
|
||||
const isCommonjs = args.namespace.endsWith('commonjs');
|
||||
const resolved = polyfilledBuiltins.get(removeEndingSlash(argsPath));
|
||||
const contents = yield (yield fs_1.default.promises.readFile(resolved)).toString();
|
||||
let resolveDir = path_1.default.dirname(resolved);
|
||||
if (isCommonjs) {
|
||||
return {
|
||||
loader: 'js',
|
||||
contents: commonJsTemplate({
|
||||
importPath: argsPath,
|
||||
}),
|
||||
resolveDir,
|
||||
};
|
||||
}
|
||||
return {
|
||||
loader: 'js',
|
||||
contents,
|
||||
resolveDir,
|
||||
};
|
||||
}
|
||||
catch (e) {
|
||||
console.error('node-modules-polyfill', e);
|
||||
return {
|
||||
contents: `export {}`,
|
||||
loader: 'js',
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
onLoad({ filter: /.*/, namespace }, loader);
|
||||
onLoad({ filter: /.*/, namespace: commonjsNamespace }, loader);
|
||||
const filter = new RegExp([
|
||||
...polyfilledBuiltinsNames,
|
||||
...polyfilledBuiltinsNames.map((n) => `node:${n}`),
|
||||
]
|
||||
.map(escape_string_regexp_1.default)
|
||||
.join('|'));
|
||||
function resolver(args) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const argsPath = args.path.replace(/^node:/, '');
|
||||
const ignoreRequire = args.namespace === commonjsNamespace;
|
||||
if (!polyfilledBuiltins.has(argsPath)) {
|
||||
return;
|
||||
}
|
||||
const isCommonjs = !ignoreRequire && args.kind === 'require-call';
|
||||
return {
|
||||
namespace: isCommonjs ? commonjsNamespace : namespace,
|
||||
path: argsPath,
|
||||
};
|
||||
});
|
||||
}
|
||||
onResolve({ filter }, resolver);
|
||||
// onResolve({ filter: /.*/, namespace }, resolver)
|
||||
},
|
||||
};
|
||||
}
|
||||
exports.NodeModulesPolyfillPlugin = NodeModulesPolyfillPlugin;
|
||||
function commonJsTemplate({ importPath }) {
|
||||
return `
|
||||
const polyfill = require('${importPath}')
|
||||
|
||||
if (polyfill && polyfill.default) {
|
||||
module.exports = polyfill.default
|
||||
for (let k in polyfill) {
|
||||
module.exports[k] = polyfill[k]
|
||||
}
|
||||
} else if (polyfill) {
|
||||
module.exports = polyfill
|
||||
}
|
||||
|
||||
|
||||
`;
|
||||
}
|
||||
exports.default = NodeModulesPolyfillPlugin;
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@esbuild-plugins/node-modules-polyfill/dist/index.js.map
generated
vendored
Normal file
1
node_modules/@esbuild-plugins/node-modules-polyfill/dist/index.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,gFAAqD;AACrD,4CAAmB;AACnB,gDAAuB;AAEvB,2CAA+C;AAE/C,oEAAoE;AACpE,MAAM,IAAI,GAAG,wBAAwB,CAAA;AACrC,MAAM,SAAS,GAAG,IAAI,CAAA;AAEtB,SAAS,iBAAiB,CAAC,QAAQ;IAC/B,IAAI,QAAQ,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QACxC,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;KACnC;IACD,OAAO,QAAQ,CAAA;AACnB,CAAC;AAOD,SAAgB,yBAAyB,CACrC,UAAgC,EAAE;IAElC,MAAM,EAAE,SAAS,GAAG,SAAS,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,OAAO,CAAA;IACtD,IAAI,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;QAChC,MAAM,IAAI,KAAK,CAAC,aAAa,SAAS,6BAA6B,CAAC,CAAA;KACvE;IACD,+IAA+I;IAC/I,MAAM,iBAAiB,GAAG,SAAS,GAAG,WAAW,CAAA;IACjD,MAAM,kBAAkB,GAAG,6BAAiB,EAAE,CAAA;IAC9C,MAAM,uBAAuB,GAAG,CAAC,GAAG,kBAAkB,CAAC,IAAI,EAAE,CAAC,CAAA;IAE9D,O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AS,gBAAgB,CAAC,EAAE,UAAU,EAAE;IACpC,OAAO;4BACiB,UAAU;;;;;;;;;;;;CAYrC,CAAA;AACD,CAAC;AAED,kBAAe,yBAAyB,CAAA"}
|
2
node_modules/@esbuild-plugins/node-modules-polyfill/dist/index.test.d.ts
generated
vendored
Normal file
2
node_modules/@esbuild-plugins/node-modules-polyfill/dist/index.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=index.test.d.ts.map
|
1
node_modules/@esbuild-plugins/node-modules-polyfill/dist/index.test.d.ts.map
generated
vendored
Normal file
1
node_modules/@esbuild-plugins/node-modules-polyfill/dist/index.test.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":""}
|
183
node_modules/@esbuild-plugins/node-modules-polyfill/dist/index.test.js
generated
vendored
Normal file
183
node_modules/@esbuild-plugins/node-modules-polyfill/dist/index.test.js
generated
vendored
Normal file
|
@ -0,0 +1,183 @@
|
|||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const esbuild_1 = require("esbuild");
|
||||
const test_support_1 = require("test-support");
|
||||
const fs_1 = __importDefault(require("fs"));
|
||||
const _1 = __importDefault(require("."));
|
||||
const node_globals_polyfill_1 = __importDefault(require("@esbuild-plugins/node-globals-polyfill"));
|
||||
require('debug').enable(require('../package.json').name);
|
||||
test('works', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield test_support_1.writeFiles({
|
||||
'entry.ts': `import {x} from './utils'; console.log(x);`,
|
||||
'utils.ts': `import path from 'path'; import { Buffer } from 'buffer'; export const x = path.resolve(Buffer.from('x').toString());`,
|
||||
});
|
||||
// const outfile = randomOutputFile()
|
||||
const res = yield esbuild_1.build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [_1.default()],
|
||||
});
|
||||
eval(res.outputFiles[0].text);
|
||||
// console.log(res.outputFiles[0].text)
|
||||
unlink();
|
||||
}));
|
||||
test('works with SafeBuffer and other package consumers', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield test_support_1.writeFiles({
|
||||
'entry.ts': `import {Buffer as SafeBuffer} from './safe-buffer'; console.log(SafeBuffer);`,
|
||||
'safe-buffer.ts': fs_1.default
|
||||
.readFileSync(require.resolve('safe-buffer'))
|
||||
.toString(),
|
||||
});
|
||||
// const outfile = randomOutputFile()
|
||||
const res = yield esbuild_1.build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [_1.default()],
|
||||
});
|
||||
// console.log(
|
||||
// res.outputFiles[0].text
|
||||
// .split('\n')
|
||||
// .map((x, i) => i + ' ' + x)
|
||||
// .join('\n'),
|
||||
// )
|
||||
eval(res.outputFiles[0].text);
|
||||
unlink();
|
||||
}));
|
||||
test('events works', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield test_support_1.writeFiles({
|
||||
'entry.ts': `
|
||||
import EventEmitter from 'events';
|
||||
|
||||
class Test extends EventEmitter {
|
||||
constructor() { };
|
||||
}
|
||||
console.log(Test)
|
||||
`,
|
||||
});
|
||||
// const outfile = randomOutputFile()
|
||||
const res = yield esbuild_1.build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [_1.default()],
|
||||
});
|
||||
// console.log(res.outputFiles[0].text)
|
||||
eval(res.outputFiles[0].text);
|
||||
unlink();
|
||||
}));
|
||||
test('require can use default export', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield test_support_1.writeFiles({
|
||||
'entry.ts': `
|
||||
const assert = require('assert')
|
||||
// console.log(assert)
|
||||
assert('ok')
|
||||
`,
|
||||
});
|
||||
// const outfile = randomOutputFile()
|
||||
const res = yield esbuild_1.build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [_1.default()],
|
||||
});
|
||||
// console.log(res.outputFiles[0].text)
|
||||
eval(res.outputFiles[0].text);
|
||||
unlink();
|
||||
}));
|
||||
test.skip('crypto', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield test_support_1.writeFiles({
|
||||
'entry.ts': `import { randomBytes } from 'crypto'; console.log(randomBytes(20).toString('hex'))`,
|
||||
});
|
||||
// const outfile = randomOutputFile()
|
||||
const res = yield esbuild_1.build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [_1.default()],
|
||||
});
|
||||
eval(res.outputFiles[0].text);
|
||||
// console.log(res.outputFiles[0].text)
|
||||
unlink();
|
||||
}));
|
||||
test.skip('fs', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield test_support_1.writeFiles({
|
||||
'entry.ts': `import { readFile } from 'fs'; console.log(readFile(''))`,
|
||||
});
|
||||
// const outfile = randomOutputFile()
|
||||
const res = yield esbuild_1.build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [_1.default()],
|
||||
});
|
||||
eval(res.outputFiles[0].text);
|
||||
// console.log(res.outputFiles[0].text)
|
||||
unlink();
|
||||
}));
|
||||
test('does not include global keyword', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield test_support_1.writeFiles({
|
||||
'entry.ts': `import {x} from './utils'; console.log(x);`,
|
||||
'utils.ts': `import path from 'path'; import { Buffer } from 'buffer'; export const x = path.resolve(Buffer.from('x').toString());`,
|
||||
});
|
||||
// const outfile = randomOutputFile()
|
||||
const res = yield esbuild_1.build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [_1.default()],
|
||||
});
|
||||
const text = res.outputFiles[0].text;
|
||||
eval(text);
|
||||
expect(text).not.toContain(/\bglobal\b/);
|
||||
// console.log(res.outputFiles[0].text)
|
||||
unlink();
|
||||
}));
|
||||
test('works with globals polyfills', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield test_support_1.writeFiles({
|
||||
'entry.ts': `import {x} from './utils'; console.log(x);`,
|
||||
'utils.ts': `import path from 'path'; import { Buffer } from 'buffer'; export const x = path.resolve(Buffer.from('x').toString());`,
|
||||
});
|
||||
// const outfile = randomOutputFile()
|
||||
const res = yield esbuild_1.build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [_1.default(), node_globals_polyfill_1.default()],
|
||||
});
|
||||
const text = res.outputFiles[0].text;
|
||||
eval(text);
|
||||
console.log(text);
|
||||
// console.log(res.outputFiles[0].text)
|
||||
unlink();
|
||||
}));
|
||||
//# sourceMappingURL=index.test.js.map
|
1
node_modules/@esbuild-plugins/node-modules-polyfill/dist/index.test.js.map
generated
vendored
Normal file
1
node_modules/@esbuild-plugins/node-modules-polyfill/dist/index.test.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qCAA+B;AAC/B,+CAAyC;AACzC,4CAAmB;AACnB,yCAA0C;AAC1C,mGAA+E;AAE/E,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,CAAA;AAExD,IAAI,CAAC,OAAO,EAAE,GAAS,EAAE;IACrB,MAAM,EACF,MAAM,EACN,KAAK,EAAE,CAAC,KAAK,CAAC,GACjB,GAAG,MAAM,yBAAU,CAAC;QACjB,UAAU,EAAE,4CAA4C;QACxD,UAAU,EAAE,uHAAuH;KACtI,CAAC,CAAA;IACF,qCAAqC;IACrC,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC;QACpB,WAAW,EAAE,CAAC,KAAK,CAAC;QACpB,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,CAAC,UAA0B,EAAE,CAAC;KAC1C,CAAC,CAAA;IACF,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IAC7B,uCAAuC;IACvC,MAAM,EAAE,CAAA;AACZ,CAAC,CAAA,CAAC,CAAA;AAEF,IAAI,CAAC,mDAAmD,EAAE,GAAS,EAAE;IACjE,MAAM,EACF,MAAM,EACN,KAAK,EAAE,CAAC,KAAK,CAAC,GACjB,GAAG,MAAM,yBAAU,CAAC;QACjB,UAAU,EAAE,8EAA8E;QAC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EACN,KAAK,EAAE,CAAC,KAAK,CAAC,GACjB,GAAG,MAAM,yBAAU,CAAC;QACjB,UAAU,EAAE,4CAA4C;QACxD,UAAU,EAAE,uHAAuH;KACtI,CAAC,CAAA;IACF,qCAAqC;IACrC,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC;QACpB,WAAW,EAAE,CAAC,KAAK,CAAC;QACpB,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,CAAC,UAA0B,EAAE,EAAE,+BAA0B,EAAE,CAAC;KACxE,CAAC,CAAA;IACF,MAAM,IAAI,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACpC,IAAI,CAAC,IAAI,CAAC,CAAA;IACV,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACjB,uCAAuC;IACvC,MAAM,EAAE,CAAA;AACZ,CAAC,CAAA,CAAC,CAAA"}
|
2
node_modules/@esbuild-plugins/node-modules-polyfill/dist/polyfills.d.ts
generated
vendored
Normal file
2
node_modules/@esbuild-plugins/node-modules-polyfill/dist/polyfills.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export declare function builtinsPolyfills(): Map<any, any>;
|
||||
//# sourceMappingURL=polyfills.d.ts.map
|
1
node_modules/@esbuild-plugins/node-modules-polyfill/dist/polyfills.d.ts.map
generated
vendored
Normal file
1
node_modules/@esbuild-plugins/node-modules-polyfill/dist/polyfills.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"polyfills.d.ts","sourceRoot":"","sources":["../src/polyfills.ts"],"names":[],"mappings":"AAQA,wBAAgB,iBAAiB,kBA8IhC"}
|
61
node_modules/@esbuild-plugins/node-modules-polyfill/dist/polyfills.js
generated
vendored
Normal file
61
node_modules/@esbuild-plugins/node-modules-polyfill/dist/polyfills.js
generated
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
"use strict";
|
||||
// Taken from https://github.com/ionic-team/rollup-plugin-node-polyfills/blob/master/src/modules.ts
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.builtinsPolyfills = void 0;
|
||||
const EMPTY_PATH = require.resolve('rollup-plugin-node-polyfills/polyfills/empty.js');
|
||||
function builtinsPolyfills() {
|
||||
const libs = new Map();
|
||||
libs.set('process', require.resolve('rollup-plugin-node-polyfills/polyfills/process-es6'));
|
||||
libs.set('buffer', require.resolve('rollup-plugin-node-polyfills/polyfills/buffer-es6'));
|
||||
libs.set('util', require.resolve('rollup-plugin-node-polyfills/polyfills/util'));
|
||||
libs.set('sys', libs.get('util'));
|
||||
libs.set('events', require.resolve('rollup-plugin-node-polyfills/polyfills/events'));
|
||||
libs.set('stream', require.resolve('rollup-plugin-node-polyfills/polyfills/stream'));
|
||||
libs.set('path', require.resolve('rollup-plugin-node-polyfills/polyfills/path'));
|
||||
libs.set('querystring', require.resolve('rollup-plugin-node-polyfills/polyfills/qs'));
|
||||
libs.set('punycode', require.resolve('rollup-plugin-node-polyfills/polyfills/punycode'));
|
||||
libs.set('url', require.resolve('rollup-plugin-node-polyfills/polyfills/url'));
|
||||
libs.set('string_decoder', require.resolve('rollup-plugin-node-polyfills/polyfills/string-decoder'));
|
||||
libs.set('http', require.resolve('rollup-plugin-node-polyfills/polyfills/http'));
|
||||
libs.set('https', require.resolve('rollup-plugin-node-polyfills/polyfills/http'));
|
||||
libs.set('os', require.resolve('rollup-plugin-node-polyfills/polyfills/os'));
|
||||
libs.set('assert', require.resolve('rollup-plugin-node-polyfills/polyfills/assert'));
|
||||
libs.set('constants', require.resolve('rollup-plugin-node-polyfills/polyfills/constants'));
|
||||
libs.set('_stream_duplex', require.resolve('rollup-plugin-node-polyfills/polyfills/readable-stream/duplex'));
|
||||
libs.set('_stream_passthrough', require.resolve('rollup-plugin-node-polyfills/polyfills/readable-stream/passthrough'));
|
||||
libs.set('_stream_readable', require.resolve('rollup-plugin-node-polyfills/polyfills/readable-stream/readable'));
|
||||
libs.set('_stream_writable', require.resolve('rollup-plugin-node-polyfills/polyfills/readable-stream/writable'));
|
||||
libs.set('_stream_transform', require.resolve('rollup-plugin-node-polyfills/polyfills/readable-stream/transform'));
|
||||
libs.set('timers', require.resolve('rollup-plugin-node-polyfills/polyfills/timers'));
|
||||
libs.set('console', require.resolve('rollup-plugin-node-polyfills/polyfills/console'));
|
||||
libs.set('vm', require.resolve('rollup-plugin-node-polyfills/polyfills/vm'));
|
||||
libs.set('zlib', require.resolve('rollup-plugin-node-polyfills/polyfills/zlib'));
|
||||
libs.set('tty', require.resolve('rollup-plugin-node-polyfills/polyfills/tty'));
|
||||
libs.set('domain', require.resolve('rollup-plugin-node-polyfills/polyfills/domain'));
|
||||
// not shimmed
|
||||
libs.set('dns', EMPTY_PATH);
|
||||
libs.set('dgram', EMPTY_PATH);
|
||||
libs.set('child_process', EMPTY_PATH);
|
||||
libs.set('cluster', EMPTY_PATH);
|
||||
libs.set('module', EMPTY_PATH);
|
||||
libs.set('net', EMPTY_PATH);
|
||||
libs.set('readline', EMPTY_PATH);
|
||||
libs.set('repl', EMPTY_PATH);
|
||||
libs.set('tls', EMPTY_PATH);
|
||||
libs.set('fs', EMPTY_PATH);
|
||||
libs.set('crypto', EMPTY_PATH);
|
||||
// libs.set(
|
||||
// 'fs',
|
||||
// require.resolve('rollup-plugin-node-polyfills/polyfills/browserify-fs'),
|
||||
// )
|
||||
// TODO enable crypto and fs https://github.com/ionic-team/rollup-plugin-node-polyfills/issues/20
|
||||
// libs.set(
|
||||
// 'crypto',
|
||||
// require.resolve(
|
||||
// 'rollup-plugin-node-polyfills/polyfills/crypto-browserify',
|
||||
// ),
|
||||
// )
|
||||
return libs;
|
||||
}
|
||||
exports.builtinsPolyfills = builtinsPolyfills;
|
||||
//# sourceMappingURL=polyfills.js.map
|
1
node_modules/@esbuild-plugins/node-modules-polyfill/dist/polyfills.js.map
generated
vendored
Normal file
1
node_modules/@esbuild-plugins/node-modules-polyfill/dist/polyfills.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"polyfills.js","sourceRoot":"","sources":["../src/polyfills.ts"],"names":[],"mappings":";AAAA,mGAAmG;;;AAInG,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAC9B,iDAAiD,CACpD,CAAA;AAED,SAAgB,iBAAiB;IAC7B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAE,CAAA;IAEtB,IAAI,CAAC,GAAG,CACJ,SAAS,EACT,OAAO,CAAC,OAAO,CAAC,oDAAoD,CAAC,CACxE,CAAA;IACD,IAAI,CAAC,GAAG,CACJ,QAAQ,EACR,OAAO,CAAC,OAAO,CAAC,mDAAmD,CAAC,CACvE,CAAA;IACD,IAAI,CAAC,GAAG,CACJ,MAAM,EACN,OAAO,CAAC,OAAO,CAAC,6CAA6C,CAAC,CACjE,CAAA;IACD,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IACjC,IAAI,CAAC,GAAG,CACJ,QAAQ,EACR,OAAO,CAAC,OAAO,CAAC,+CAA+C,CAAC,CACnE,CAAA;IACD,IAAI,CAAC,GAAG,CACJ,QAAQ,EACR,OAAO,CAAC,OAAO,CAAC,+CAA+C,CAAC,CACnE,CAAA;IACD,IAAI,CAAC,GAAG,CACJ,MAAM,EACN,OAAO,CAAC,OAAO,CAAC,6CAA6C,CAAC,CACjE,CAAA;IACD,IAAI,CAAC,GAAG,CACJ,aAAa,EACb,OAAO,CAAC,OAAO,CAAC,2CAA2C,CAAC,CAC/D,CAAA;IACD,IAAI,CAAC,GAAG,CACJ,UAAU,EACV,OAAO,CAAC,OAAO,CAAC,iDAAiD,CAAC,CACrE,CAAA;IACD,IAAI,CAAC,GAAG,CACJ,KAAK,EACL,OAAO,CAAC,OAAO,CAAC,4CAA4C,CAAC,CAChE,CAAA;IACD,IAAI,CAA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/esm/index.d.ts
generated
vendored
Normal file
8
node_modules/@esbuild-plugins/node-modules-polyfill/esm/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
import { Plugin } from 'esbuild';
|
||||
export interface NodePolyfillsOptions {
|
||||
name?: string;
|
||||
namespace?: string;
|
||||
}
|
||||
export declare function NodeModulesPolyfillPlugin(options?: NodePolyfillsOptions): Plugin;
|
||||
export default NodeModulesPolyfillPlugin;
|
||||
//# sourceMappingURL=index.d.ts.map
|
1
node_modules/@esbuild-plugins/node-modules-polyfill/esm/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@esbuild-plugins/node-modules-polyfill/esm/index.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,MAAM,EAAE,MAAM,SAAS,CAAA;AAkB/C,MAAM,WAAW,oBAAoB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,wBAAgB,yBAAyB,CACrC,OAAO,GAAE,oBAAyB,GACnC,MAAM,CAwFR;AAmBD,eAAe,yBAAyB,CAAA"}
|
120
node_modules/@esbuild-plugins/node-modules-polyfill/esm/index.js
generated
vendored
Normal file
120
node_modules/@esbuild-plugins/node-modules-polyfill/esm/index.js
generated
vendored
Normal file
|
@ -0,0 +1,120 @@
|
|||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
import escapeStringRegexp from 'escape-string-regexp';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { builtinsPolyfills } from './polyfills';
|
||||
// import { NodeResolvePlugin } from '@esbuild-plugins/node-resolve'
|
||||
const NAME = 'node-modules-polyfills';
|
||||
const NAMESPACE = NAME;
|
||||
function removeEndingSlash(importee) {
|
||||
if (importee && importee.slice(-1) === '/') {
|
||||
importee = importee.slice(0, -1);
|
||||
}
|
||||
return importee;
|
||||
}
|
||||
export function NodeModulesPolyfillPlugin(options = {}) {
|
||||
const { namespace = NAMESPACE, name = NAME } = options;
|
||||
if (namespace.endsWith('commonjs')) {
|
||||
throw new Error(`namespace ${namespace} must not end with commonjs`);
|
||||
}
|
||||
// this namespace is needed to make ES modules expose their default export to require: require('assert') will give you import('assert').default
|
||||
const commonjsNamespace = namespace + '-commonjs';
|
||||
const polyfilledBuiltins = builtinsPolyfills();
|
||||
const polyfilledBuiltinsNames = [...polyfilledBuiltins.keys()];
|
||||
return {
|
||||
name,
|
||||
setup: function setup({ onLoad, onResolve, initialOptions }) {
|
||||
var _a;
|
||||
// polyfills contain global keyword, it must be defined
|
||||
if ((initialOptions === null || initialOptions === void 0 ? void 0 : initialOptions.define) && !((_a = initialOptions.define) === null || _a === void 0 ? void 0 : _a.global)) {
|
||||
initialOptions.define['global'] = 'globalThis';
|
||||
}
|
||||
else if (!(initialOptions === null || initialOptions === void 0 ? void 0 : initialOptions.define)) {
|
||||
initialOptions.define = { global: 'globalThis' };
|
||||
}
|
||||
// TODO these polyfill module cannot import anything, is that ok?
|
||||
function loader(args) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const argsPath = args.path.replace(/^node:/, '');
|
||||
const isCommonjs = args.namespace.endsWith('commonjs');
|
||||
const resolved = polyfilledBuiltins.get(removeEndingSlash(argsPath));
|
||||
const contents = yield (yield fs.promises.readFile(resolved)).toString();
|
||||
let resolveDir = path.dirname(resolved);
|
||||
if (isCommonjs) {
|
||||
return {
|
||||
loader: 'js',
|
||||
contents: commonJsTemplate({
|
||||
importPath: argsPath,
|
||||
}),
|
||||
resolveDir,
|
||||
};
|
||||
}
|
||||
return {
|
||||
loader: 'js',
|
||||
contents,
|
||||
resolveDir,
|
||||
};
|
||||
}
|
||||
catch (e) {
|
||||
console.error('node-modules-polyfill', e);
|
||||
return {
|
||||
contents: `export {}`,
|
||||
loader: 'js',
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
onLoad({ filter: /.*/, namespace }, loader);
|
||||
onLoad({ filter: /.*/, namespace: commonjsNamespace }, loader);
|
||||
const filter = new RegExp([
|
||||
...polyfilledBuiltinsNames,
|
||||
...polyfilledBuiltinsNames.map((n) => `node:${n}`),
|
||||
]
|
||||
.map(escapeStringRegexp)
|
||||
.join('|'));
|
||||
function resolver(args) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const argsPath = args.path.replace(/^node:/, '');
|
||||
const ignoreRequire = args.namespace === commonjsNamespace;
|
||||
if (!polyfilledBuiltins.has(argsPath)) {
|
||||
return;
|
||||
}
|
||||
const isCommonjs = !ignoreRequire && args.kind === 'require-call';
|
||||
return {
|
||||
namespace: isCommonjs ? commonjsNamespace : namespace,
|
||||
path: argsPath,
|
||||
};
|
||||
});
|
||||
}
|
||||
onResolve({ filter }, resolver);
|
||||
// onResolve({ filter: /.*/, namespace }, resolver)
|
||||
},
|
||||
};
|
||||
}
|
||||
function commonJsTemplate({ importPath }) {
|
||||
return `
|
||||
const polyfill = require('${importPath}')
|
||||
|
||||
if (polyfill && polyfill.default) {
|
||||
module.exports = polyfill.default
|
||||
for (let k in polyfill) {
|
||||
module.exports[k] = polyfill[k]
|
||||
}
|
||||
} else if (polyfill) {
|
||||
module.exports = polyfill
|
||||
}
|
||||
|
||||
|
||||
`;
|
||||
}
|
||||
export default NodeModulesPolyfillPlugin;
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@esbuild-plugins/node-modules-polyfill/esm/index.js.map
generated
vendored
Normal file
1
node_modules/@esbuild-plugins/node-modules-polyfill/esm/index.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,kBAAkB,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAE/C,oEAAoE;AACpE,MAAM,IAAI,GAAG,wBAAwB,CAAA;AACrC,MAAM,SAAS,GAAG,IAAI,CAAA;AAEtB,SAAS,iBAAiB,CAAC,QAAQ;IAC/B,IAAI,QAAQ,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QACxC,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;KACnC;IACD,OAAO,QAAQ,CAAA;AACnB,CAAC;AAOD,MAAM,UAAU,yBAAyB,CACrC,UAAgC,EAAE;IAElC,MAAM,EAAE,SAAS,GAAG,SAAS,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,OAAO,CAAA;IACtD,IAAI,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;QAChC,MAAM,IAAI,KAAK,CAAC,aAAa,SAAS,6BAA6B,CAAC,CAAA;KACvE;IACD,+IAA+I;IAC/I,MAAM,iBAAiB,GAAG,SAAS,GAAG,WAAW,CAAA;IACjD,MAAM,kBAAkB,GAAG,iBAAiB,EAAE,CAAA;IAC9C,MAAM,uBAAuB,GAAG,CAAC,GAAG,kBAAkB,CAAC,IAAI,EAAE,CAAC,CAAA;IAE9D,OAAO;QACH,IAAI;QACJ,KAAK,EAAE,SAAS,KAAK,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE;;YACv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yB,CAAA"}
|
2
node_modules/@esbuild-plugins/node-modules-polyfill/esm/index.test.d.ts
generated
vendored
Normal file
2
node_modules/@esbuild-plugins/node-modules-polyfill/esm/index.test.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export {};
|
||||
//# sourceMappingURL=index.test.d.ts.map
|
1
node_modules/@esbuild-plugins/node-modules-polyfill/esm/index.test.d.ts.map
generated
vendored
Normal file
1
node_modules/@esbuild-plugins/node-modules-polyfill/esm/index.test.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":""}
|
178
node_modules/@esbuild-plugins/node-modules-polyfill/esm/index.test.js
generated
vendored
Normal file
178
node_modules/@esbuild-plugins/node-modules-polyfill/esm/index.test.js
generated
vendored
Normal file
|
@ -0,0 +1,178 @@
|
|||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
import { build } from 'esbuild';
|
||||
import { writeFiles } from 'test-support';
|
||||
import fs from 'fs';
|
||||
import NodeModulesPolyfillsPlugin from '.';
|
||||
import NodeGlobalsPolyfillsPlugin from '@esbuild-plugins/node-globals-polyfill';
|
||||
require('debug').enable(require('../package.json').name);
|
||||
test('works', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield writeFiles({
|
||||
'entry.ts': `import {x} from './utils'; console.log(x);`,
|
||||
'utils.ts': `import path from 'path'; import { Buffer } from 'buffer'; export const x = path.resolve(Buffer.from('x').toString());`,
|
||||
});
|
||||
// const outfile = randomOutputFile()
|
||||
const res = yield build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [NodeModulesPolyfillsPlugin()],
|
||||
});
|
||||
eval(res.outputFiles[0].text);
|
||||
// console.log(res.outputFiles[0].text)
|
||||
unlink();
|
||||
}));
|
||||
test('works with SafeBuffer and other package consumers', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield writeFiles({
|
||||
'entry.ts': `import {Buffer as SafeBuffer} from './safe-buffer'; console.log(SafeBuffer);`,
|
||||
'safe-buffer.ts': fs
|
||||
.readFileSync(require.resolve('safe-buffer'))
|
||||
.toString(),
|
||||
});
|
||||
// const outfile = randomOutputFile()
|
||||
const res = yield build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [NodeModulesPolyfillsPlugin()],
|
||||
});
|
||||
// console.log(
|
||||
// res.outputFiles[0].text
|
||||
// .split('\n')
|
||||
// .map((x, i) => i + ' ' + x)
|
||||
// .join('\n'),
|
||||
// )
|
||||
eval(res.outputFiles[0].text);
|
||||
unlink();
|
||||
}));
|
||||
test('events works', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield writeFiles({
|
||||
'entry.ts': `
|
||||
import EventEmitter from 'events';
|
||||
|
||||
class Test extends EventEmitter {
|
||||
constructor() { };
|
||||
}
|
||||
console.log(Test)
|
||||
`,
|
||||
});
|
||||
// const outfile = randomOutputFile()
|
||||
const res = yield build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [NodeModulesPolyfillsPlugin()],
|
||||
});
|
||||
// console.log(res.outputFiles[0].text)
|
||||
eval(res.outputFiles[0].text);
|
||||
unlink();
|
||||
}));
|
||||
test('require can use default export', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield writeFiles({
|
||||
'entry.ts': `
|
||||
const assert = require('assert')
|
||||
// console.log(assert)
|
||||
assert('ok')
|
||||
`,
|
||||
});
|
||||
// const outfile = randomOutputFile()
|
||||
const res = yield build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [NodeModulesPolyfillsPlugin()],
|
||||
});
|
||||
// console.log(res.outputFiles[0].text)
|
||||
eval(res.outputFiles[0].text);
|
||||
unlink();
|
||||
}));
|
||||
test.skip('crypto', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield writeFiles({
|
||||
'entry.ts': `import { randomBytes } from 'crypto'; console.log(randomBytes(20).toString('hex'))`,
|
||||
});
|
||||
// const outfile = randomOutputFile()
|
||||
const res = yield build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [NodeModulesPolyfillsPlugin()],
|
||||
});
|
||||
eval(res.outputFiles[0].text);
|
||||
// console.log(res.outputFiles[0].text)
|
||||
unlink();
|
||||
}));
|
||||
test.skip('fs', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield writeFiles({
|
||||
'entry.ts': `import { readFile } from 'fs'; console.log(readFile(''))`,
|
||||
});
|
||||
// const outfile = randomOutputFile()
|
||||
const res = yield build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [NodeModulesPolyfillsPlugin()],
|
||||
});
|
||||
eval(res.outputFiles[0].text);
|
||||
// console.log(res.outputFiles[0].text)
|
||||
unlink();
|
||||
}));
|
||||
test('does not include global keyword', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield writeFiles({
|
||||
'entry.ts': `import {x} from './utils'; console.log(x);`,
|
||||
'utils.ts': `import path from 'path'; import { Buffer } from 'buffer'; export const x = path.resolve(Buffer.from('x').toString());`,
|
||||
});
|
||||
// const outfile = randomOutputFile()
|
||||
const res = yield build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [NodeModulesPolyfillsPlugin()],
|
||||
});
|
||||
const text = res.outputFiles[0].text;
|
||||
eval(text);
|
||||
expect(text).not.toContain(/\bglobal\b/);
|
||||
// console.log(res.outputFiles[0].text)
|
||||
unlink();
|
||||
}));
|
||||
test('works with globals polyfills', () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { unlink, paths: [ENTRY], } = yield writeFiles({
|
||||
'entry.ts': `import {x} from './utils'; console.log(x);`,
|
||||
'utils.ts': `import path from 'path'; import { Buffer } from 'buffer'; export const x = path.resolve(Buffer.from('x').toString());`,
|
||||
});
|
||||
// const outfile = randomOutputFile()
|
||||
const res = yield build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [NodeModulesPolyfillsPlugin(), NodeGlobalsPolyfillsPlugin()],
|
||||
});
|
||||
const text = res.outputFiles[0].text;
|
||||
eval(text);
|
||||
console.log(text);
|
||||
// console.log(res.outputFiles[0].text)
|
||||
unlink();
|
||||
}));
|
||||
//# sourceMappingURL=index.test.js.map
|
1
node_modules/@esbuild-plugins/node-modules-polyfill/esm/index.test.js.map
generated
vendored
Normal file
1
node_modules/@esbuild-plugins/node-modules-polyfill/esm/index.test.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],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AA;IACF,qCAAqC;IACrC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC;QACpB,WAAW,EAAE,CAAC,KAAK,CAAC;QACpB,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,IAAI;QACZ,OAAO,EAAE,CAAC,0BAA0B,EAAE,EAAE,0BAA0B,EAAE,CAAC;KACxE,CAAC,CAAA;IACF,MAAM,IAAI,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACpC,IAAI,CAAC,IAAI,CAAC,CAAA;IACV,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACjB,uCAAuC;IACvC,MAAM,EAAE,CAAA;AACZ,CAAC,CAAA,CAAC,CAAA"}
|
2
node_modules/@esbuild-plugins/node-modules-polyfill/esm/polyfills.d.ts
generated
vendored
Normal file
2
node_modules/@esbuild-plugins/node-modules-polyfill/esm/polyfills.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
export declare function builtinsPolyfills(): Map<any, any>;
|
||||
//# sourceMappingURL=polyfills.d.ts.map
|
1
node_modules/@esbuild-plugins/node-modules-polyfill/esm/polyfills.d.ts.map
generated
vendored
Normal file
1
node_modules/@esbuild-plugins/node-modules-polyfill/esm/polyfills.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"polyfills.d.ts","sourceRoot":"","sources":["../src/polyfills.ts"],"names":[],"mappings":"AAQA,wBAAgB,iBAAiB,kBA8IhC"}
|
57
node_modules/@esbuild-plugins/node-modules-polyfill/esm/polyfills.js
generated
vendored
Normal file
57
node_modules/@esbuild-plugins/node-modules-polyfill/esm/polyfills.js
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
// Taken from https://github.com/ionic-team/rollup-plugin-node-polyfills/blob/master/src/modules.ts
|
||||
const EMPTY_PATH = require.resolve('rollup-plugin-node-polyfills/polyfills/empty.js');
|
||||
export function builtinsPolyfills() {
|
||||
const libs = new Map();
|
||||
libs.set('process', require.resolve('rollup-plugin-node-polyfills/polyfills/process-es6'));
|
||||
libs.set('buffer', require.resolve('rollup-plugin-node-polyfills/polyfills/buffer-es6'));
|
||||
libs.set('util', require.resolve('rollup-plugin-node-polyfills/polyfills/util'));
|
||||
libs.set('sys', libs.get('util'));
|
||||
libs.set('events', require.resolve('rollup-plugin-node-polyfills/polyfills/events'));
|
||||
libs.set('stream', require.resolve('rollup-plugin-node-polyfills/polyfills/stream'));
|
||||
libs.set('path', require.resolve('rollup-plugin-node-polyfills/polyfills/path'));
|
||||
libs.set('querystring', require.resolve('rollup-plugin-node-polyfills/polyfills/qs'));
|
||||
libs.set('punycode', require.resolve('rollup-plugin-node-polyfills/polyfills/punycode'));
|
||||
libs.set('url', require.resolve('rollup-plugin-node-polyfills/polyfills/url'));
|
||||
libs.set('string_decoder', require.resolve('rollup-plugin-node-polyfills/polyfills/string-decoder'));
|
||||
libs.set('http', require.resolve('rollup-plugin-node-polyfills/polyfills/http'));
|
||||
libs.set('https', require.resolve('rollup-plugin-node-polyfills/polyfills/http'));
|
||||
libs.set('os', require.resolve('rollup-plugin-node-polyfills/polyfills/os'));
|
||||
libs.set('assert', require.resolve('rollup-plugin-node-polyfills/polyfills/assert'));
|
||||
libs.set('constants', require.resolve('rollup-plugin-node-polyfills/polyfills/constants'));
|
||||
libs.set('_stream_duplex', require.resolve('rollup-plugin-node-polyfills/polyfills/readable-stream/duplex'));
|
||||
libs.set('_stream_passthrough', require.resolve('rollup-plugin-node-polyfills/polyfills/readable-stream/passthrough'));
|
||||
libs.set('_stream_readable', require.resolve('rollup-plugin-node-polyfills/polyfills/readable-stream/readable'));
|
||||
libs.set('_stream_writable', require.resolve('rollup-plugin-node-polyfills/polyfills/readable-stream/writable'));
|
||||
libs.set('_stream_transform', require.resolve('rollup-plugin-node-polyfills/polyfills/readable-stream/transform'));
|
||||
libs.set('timers', require.resolve('rollup-plugin-node-polyfills/polyfills/timers'));
|
||||
libs.set('console', require.resolve('rollup-plugin-node-polyfills/polyfills/console'));
|
||||
libs.set('vm', require.resolve('rollup-plugin-node-polyfills/polyfills/vm'));
|
||||
libs.set('zlib', require.resolve('rollup-plugin-node-polyfills/polyfills/zlib'));
|
||||
libs.set('tty', require.resolve('rollup-plugin-node-polyfills/polyfills/tty'));
|
||||
libs.set('domain', require.resolve('rollup-plugin-node-polyfills/polyfills/domain'));
|
||||
// not shimmed
|
||||
libs.set('dns', EMPTY_PATH);
|
||||
libs.set('dgram', EMPTY_PATH);
|
||||
libs.set('child_process', EMPTY_PATH);
|
||||
libs.set('cluster', EMPTY_PATH);
|
||||
libs.set('module', EMPTY_PATH);
|
||||
libs.set('net', EMPTY_PATH);
|
||||
libs.set('readline', EMPTY_PATH);
|
||||
libs.set('repl', EMPTY_PATH);
|
||||
libs.set('tls', EMPTY_PATH);
|
||||
libs.set('fs', EMPTY_PATH);
|
||||
libs.set('crypto', EMPTY_PATH);
|
||||
// libs.set(
|
||||
// 'fs',
|
||||
// require.resolve('rollup-plugin-node-polyfills/polyfills/browserify-fs'),
|
||||
// )
|
||||
// TODO enable crypto and fs https://github.com/ionic-team/rollup-plugin-node-polyfills/issues/20
|
||||
// libs.set(
|
||||
// 'crypto',
|
||||
// require.resolve(
|
||||
// 'rollup-plugin-node-polyfills/polyfills/crypto-browserify',
|
||||
// ),
|
||||
// )
|
||||
return libs;
|
||||
}
|
||||
//# sourceMappingURL=polyfills.js.map
|
1
node_modules/@esbuild-plugins/node-modules-polyfill/esm/polyfills.js.map
generated
vendored
Normal file
1
node_modules/@esbuild-plugins/node-modules-polyfill/esm/polyfills.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"polyfills.js","sourceRoot":"","sources":["../src/polyfills.ts"],"names":[],"mappings":"AAAA,mGAAmG;AAInG,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAC9B,iDAAiD,CACpD,CAAA;AAED,M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GAAG,CACJ,QAAQ,EACR,OAAO,CAAC,OAAO,CAAC,+CAA+C,CAAC,CACnE,CAAA;IAED,cAAc;IACd,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;IAC3B,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;IAC7B,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,CAAC,CAAA;IACrC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;IAC/B,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;IAC9B,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;IAC3B,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;IAChC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IAC5B,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;IAC3B,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;IAC1B,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;IAE9B,YAAY;IACZ,YAAY;IACZ,+EAA+E;IAC/E,IAAI;IAEJ,iGAAiG;IACjG,YAAY;IACZ,gBAAgB;IAChB,uBAAuB;IACvB,sEAAsE;IACtE,SAAS;IACT,IAAI;IAEJ,OAAO,IAAI,CAAA;AACf,CAAC"}
|
33
node_modules/@esbuild-plugins/node-modules-polyfill/package.json
generated
vendored
Normal file
33
node_modules/@esbuild-plugins/node-modules-polyfill/package.json
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"name": "@esbuild-plugins/node-modules-polyfill",
|
||||
"version": "0.2.2",
|
||||
"description": "",
|
||||
"main": "dist/index.js",
|
||||
"module": "esm/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"repository": "https://github.com/remorses/esbuild-plugins.git",
|
||||
"scripts": {
|
||||
"build": "tsc && tsc -m es6 --outDir esm",
|
||||
"watch": "tsc -w"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"src",
|
||||
"esm"
|
||||
],
|
||||
"keywords": [],
|
||||
"author": "Tommaso De Rossi, morse <beats.by.morse@gmail.com>",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"safe-buffer": "^5.2.1",
|
||||
"test-support": "*",
|
||||
"@esbuild-plugins/node-globals-polyfill": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"escape-string-regexp": "^4.0.0",
|
||||
"rollup-plugin-node-polyfills": "^0.2.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"esbuild": "*"
|
||||
}
|
||||
}
|
200
node_modules/@esbuild-plugins/node-modules-polyfill/src/index.test.ts
generated
vendored
Normal file
200
node_modules/@esbuild-plugins/node-modules-polyfill/src/index.test.ts
generated
vendored
Normal file
|
@ -0,0 +1,200 @@
|
|||
import { build } from 'esbuild'
|
||||
import { writeFiles } from 'test-support'
|
||||
import fs from 'fs'
|
||||
import NodeModulesPolyfillsPlugin from '.'
|
||||
import NodeGlobalsPolyfillsPlugin from '@esbuild-plugins/node-globals-polyfill'
|
||||
|
||||
require('debug').enable(require('../package.json').name)
|
||||
|
||||
test('works', async () => {
|
||||
const {
|
||||
unlink,
|
||||
paths: [ENTRY],
|
||||
} = await writeFiles({
|
||||
'entry.ts': `import {x} from './utils'; console.log(x);`,
|
||||
'utils.ts': `import path from 'path'; import { Buffer } from 'buffer'; export const x = path.resolve(Buffer.from('x').toString());`,
|
||||
})
|
||||
// const outfile = randomOutputFile()
|
||||
const res = await build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [NodeModulesPolyfillsPlugin()],
|
||||
})
|
||||
eval(res.outputFiles[0].text)
|
||||
// console.log(res.outputFiles[0].text)
|
||||
unlink()
|
||||
})
|
||||
|
||||
test('works with SafeBuffer and other package consumers', async () => {
|
||||
const {
|
||||
unlink,
|
||||
paths: [ENTRY],
|
||||
} = await writeFiles({
|
||||
'entry.ts': `import {Buffer as SafeBuffer} from './safe-buffer'; console.log(SafeBuffer);`,
|
||||
'safe-buffer.ts': fs
|
||||
.readFileSync(require.resolve('safe-buffer'))
|
||||
.toString(),
|
||||
})
|
||||
// const outfile = randomOutputFile()
|
||||
const res = await build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [NodeModulesPolyfillsPlugin()],
|
||||
})
|
||||
// console.log(
|
||||
// res.outputFiles[0].text
|
||||
// .split('\n')
|
||||
// .map((x, i) => i + ' ' + x)
|
||||
// .join('\n'),
|
||||
// )
|
||||
eval(res.outputFiles[0].text)
|
||||
unlink()
|
||||
})
|
||||
|
||||
test('events works', async () => {
|
||||
const {
|
||||
unlink,
|
||||
paths: [ENTRY],
|
||||
} = await writeFiles({
|
||||
'entry.ts': `
|
||||
import EventEmitter from 'events';
|
||||
|
||||
class Test extends EventEmitter {
|
||||
constructor() { };
|
||||
}
|
||||
console.log(Test)
|
||||
`,
|
||||
})
|
||||
// const outfile = randomOutputFile()
|
||||
const res = await build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [NodeModulesPolyfillsPlugin()],
|
||||
})
|
||||
// console.log(res.outputFiles[0].text)
|
||||
eval(res.outputFiles[0].text)
|
||||
unlink()
|
||||
})
|
||||
|
||||
test('require can use default export', async () => {
|
||||
const {
|
||||
unlink,
|
||||
paths: [ENTRY],
|
||||
} = await writeFiles({
|
||||
'entry.ts': `
|
||||
const assert = require('assert')
|
||||
// console.log(assert)
|
||||
assert('ok')
|
||||
`,
|
||||
})
|
||||
// const outfile = randomOutputFile()
|
||||
const res = await build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [NodeModulesPolyfillsPlugin()],
|
||||
})
|
||||
// console.log(res.outputFiles[0].text)
|
||||
eval(res.outputFiles[0].text)
|
||||
unlink()
|
||||
})
|
||||
|
||||
test.skip('crypto', async () => {
|
||||
const {
|
||||
unlink,
|
||||
paths: [ENTRY],
|
||||
} = await writeFiles({
|
||||
'entry.ts': `import { randomBytes } from 'crypto'; console.log(randomBytes(20).toString('hex'))`,
|
||||
})
|
||||
// const outfile = randomOutputFile()
|
||||
const res = await build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [NodeModulesPolyfillsPlugin()],
|
||||
})
|
||||
eval(res.outputFiles[0].text)
|
||||
// console.log(res.outputFiles[0].text)
|
||||
unlink()
|
||||
})
|
||||
test.skip('fs', async () => {
|
||||
const {
|
||||
unlink,
|
||||
paths: [ENTRY],
|
||||
} = await writeFiles({
|
||||
'entry.ts': `import { readFile } from 'fs'; console.log(readFile(''))`,
|
||||
})
|
||||
// const outfile = randomOutputFile()
|
||||
const res = await build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [NodeModulesPolyfillsPlugin()],
|
||||
})
|
||||
eval(res.outputFiles[0].text)
|
||||
// console.log(res.outputFiles[0].text)
|
||||
unlink()
|
||||
})
|
||||
|
||||
test('does not include global keyword', async () => {
|
||||
const {
|
||||
unlink,
|
||||
paths: [ENTRY],
|
||||
} = await writeFiles({
|
||||
'entry.ts': `import {x} from './utils'; console.log(x);`,
|
||||
'utils.ts': `import path from 'path'; import { Buffer } from 'buffer'; export const x = path.resolve(Buffer.from('x').toString());`,
|
||||
})
|
||||
// const outfile = randomOutputFile()
|
||||
const res = await build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [NodeModulesPolyfillsPlugin()],
|
||||
})
|
||||
const text = res.outputFiles[0].text
|
||||
eval(text)
|
||||
expect(text).not.toContain(/\bglobal\b/)
|
||||
// console.log(res.outputFiles[0].text)
|
||||
unlink()
|
||||
})
|
||||
|
||||
test('works with globals polyfills', async () => {
|
||||
const {
|
||||
unlink,
|
||||
paths: [ENTRY],
|
||||
} = await writeFiles({
|
||||
'entry.ts': `import {x} from './utils'; console.log(x);`,
|
||||
'utils.ts': `import path from 'path'; import { Buffer } from 'buffer'; export const x = path.resolve(Buffer.from('x').toString());`,
|
||||
})
|
||||
// const outfile = randomOutputFile()
|
||||
const res = await build({
|
||||
entryPoints: [ENTRY],
|
||||
write: false,
|
||||
format: 'esm',
|
||||
target: 'es2017',
|
||||
bundle: true,
|
||||
plugins: [NodeModulesPolyfillsPlugin(), NodeGlobalsPolyfillsPlugin()],
|
||||
})
|
||||
const text = res.outputFiles[0].text
|
||||
eval(text)
|
||||
console.log(text)
|
||||
// console.log(res.outputFiles[0].text)
|
||||
unlink()
|
||||
})
|
133
node_modules/@esbuild-plugins/node-modules-polyfill/src/index.ts
generated
vendored
Normal file
133
node_modules/@esbuild-plugins/node-modules-polyfill/src/index.ts
generated
vendored
Normal file
|
@ -0,0 +1,133 @@
|
|||
import { OnResolveArgs, Plugin } from 'esbuild'
|
||||
import escapeStringRegexp from 'escape-string-regexp'
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import esbuild from 'esbuild'
|
||||
import { builtinsPolyfills } from './polyfills'
|
||||
|
||||
// import { NodeResolvePlugin } from '@esbuild-plugins/node-resolve'
|
||||
const NAME = 'node-modules-polyfills'
|
||||
const NAMESPACE = NAME
|
||||
|
||||
function removeEndingSlash(importee) {
|
||||
if (importee && importee.slice(-1) === '/') {
|
||||
importee = importee.slice(0, -1)
|
||||
}
|
||||
return importee
|
||||
}
|
||||
|
||||
export interface NodePolyfillsOptions {
|
||||
name?: string
|
||||
namespace?: string
|
||||
}
|
||||
|
||||
export function NodeModulesPolyfillPlugin(
|
||||
options: NodePolyfillsOptions = {},
|
||||
): Plugin {
|
||||
const { namespace = NAMESPACE, name = NAME } = options
|
||||
if (namespace.endsWith('commonjs')) {
|
||||
throw new Error(`namespace ${namespace} must not end with commonjs`)
|
||||
}
|
||||
// this namespace is needed to make ES modules expose their default export to require: require('assert') will give you import('assert').default
|
||||
const commonjsNamespace = namespace + '-commonjs'
|
||||
const polyfilledBuiltins = builtinsPolyfills()
|
||||
const polyfilledBuiltinsNames = [...polyfilledBuiltins.keys()]
|
||||
|
||||
return {
|
||||
name,
|
||||
setup: function setup({ onLoad, onResolve, initialOptions }) {
|
||||
// polyfills contain global keyword, it must be defined
|
||||
if (initialOptions?.define && !initialOptions.define?.global) {
|
||||
initialOptions.define['global'] = 'globalThis'
|
||||
} else if (!initialOptions?.define) {
|
||||
initialOptions.define = { global: 'globalThis' }
|
||||
}
|
||||
|
||||
// TODO these polyfill module cannot import anything, is that ok?
|
||||
async function loader(
|
||||
args: esbuild.OnLoadArgs,
|
||||
): Promise<esbuild.OnLoadResult> {
|
||||
try {
|
||||
const argsPath = args.path.replace(/^node:/, '')
|
||||
const isCommonjs = args.namespace.endsWith('commonjs')
|
||||
|
||||
const resolved = polyfilledBuiltins.get(
|
||||
removeEndingSlash(argsPath),
|
||||
)
|
||||
const contents = await (
|
||||
await fs.promises.readFile(resolved)
|
||||
).toString()
|
||||
let resolveDir = path.dirname(resolved)
|
||||
|
||||
if (isCommonjs) {
|
||||
return {
|
||||
loader: 'js',
|
||||
contents: commonJsTemplate({
|
||||
importPath: argsPath,
|
||||
}),
|
||||
resolveDir,
|
||||
}
|
||||
}
|
||||
return {
|
||||
loader: 'js',
|
||||
contents,
|
||||
resolveDir,
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('node-modules-polyfill', e)
|
||||
return {
|
||||
contents: `export {}`,
|
||||
loader: 'js',
|
||||
}
|
||||
}
|
||||
}
|
||||
onLoad({ filter: /.*/, namespace }, loader)
|
||||
onLoad({ filter: /.*/, namespace: commonjsNamespace }, loader)
|
||||
const filter = new RegExp(
|
||||
[
|
||||
...polyfilledBuiltinsNames,
|
||||
...polyfilledBuiltinsNames.map((n) => `node:${n}`),
|
||||
]
|
||||
.map(escapeStringRegexp)
|
||||
.join('|'), // TODO builtins could end with slash, keep in mind in regex
|
||||
)
|
||||
async function resolver(args: OnResolveArgs) {
|
||||
const argsPath = args.path.replace(/^node:/, '')
|
||||
const ignoreRequire = args.namespace === commonjsNamespace
|
||||
|
||||
if (!polyfilledBuiltins.has(argsPath)) {
|
||||
return
|
||||
}
|
||||
|
||||
const isCommonjs =
|
||||
!ignoreRequire && args.kind === 'require-call'
|
||||
|
||||
return {
|
||||
namespace: isCommonjs ? commonjsNamespace : namespace,
|
||||
path: argsPath,
|
||||
}
|
||||
}
|
||||
onResolve({ filter }, resolver)
|
||||
// onResolve({ filter: /.*/, namespace }, resolver)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
function commonJsTemplate({ importPath }) {
|
||||
return `
|
||||
const polyfill = require('${importPath}')
|
||||
|
||||
if (polyfill && polyfill.default) {
|
||||
module.exports = polyfill.default
|
||||
for (let k in polyfill) {
|
||||
module.exports[k] = polyfill[k]
|
||||
}
|
||||
} else if (polyfill) {
|
||||
module.exports = polyfill
|
||||
}
|
||||
|
||||
|
||||
`
|
||||
}
|
||||
|
||||
export default NodeModulesPolyfillPlugin
|
151
node_modules/@esbuild-plugins/node-modules-polyfill/src/polyfills.ts
generated
vendored
Normal file
151
node_modules/@esbuild-plugins/node-modules-polyfill/src/polyfills.ts
generated
vendored
Normal file
|
@ -0,0 +1,151 @@
|
|||
// Taken from https://github.com/ionic-team/rollup-plugin-node-polyfills/blob/master/src/modules.ts
|
||||
|
||||
import { NodePolyfillsOptions } from '.'
|
||||
|
||||
const EMPTY_PATH = require.resolve(
|
||||
'rollup-plugin-node-polyfills/polyfills/empty.js',
|
||||
)
|
||||
|
||||
export function builtinsPolyfills() {
|
||||
const libs = new Map()
|
||||
|
||||
libs.set(
|
||||
'process',
|
||||
require.resolve('rollup-plugin-node-polyfills/polyfills/process-es6'),
|
||||
)
|
||||
libs.set(
|
||||
'buffer',
|
||||
require.resolve('rollup-plugin-node-polyfills/polyfills/buffer-es6'),
|
||||
)
|
||||
libs.set(
|
||||
'util',
|
||||
require.resolve('rollup-plugin-node-polyfills/polyfills/util'),
|
||||
)
|
||||
libs.set('sys', libs.get('util'))
|
||||
libs.set(
|
||||
'events',
|
||||
require.resolve('rollup-plugin-node-polyfills/polyfills/events'),
|
||||
)
|
||||
libs.set(
|
||||
'stream',
|
||||
require.resolve('rollup-plugin-node-polyfills/polyfills/stream'),
|
||||
)
|
||||
libs.set(
|
||||
'path',
|
||||
require.resolve('rollup-plugin-node-polyfills/polyfills/path'),
|
||||
)
|
||||
libs.set(
|
||||
'querystring',
|
||||
require.resolve('rollup-plugin-node-polyfills/polyfills/qs'),
|
||||
)
|
||||
libs.set(
|
||||
'punycode',
|
||||
require.resolve('rollup-plugin-node-polyfills/polyfills/punycode'),
|
||||
)
|
||||
libs.set(
|
||||
'url',
|
||||
require.resolve('rollup-plugin-node-polyfills/polyfills/url'),
|
||||
)
|
||||
libs.set(
|
||||
'string_decoder',
|
||||
require.resolve(
|
||||
'rollup-plugin-node-polyfills/polyfills/string-decoder',
|
||||
),
|
||||
)
|
||||
libs.set(
|
||||
'http',
|
||||
require.resolve('rollup-plugin-node-polyfills/polyfills/http'),
|
||||
)
|
||||
libs.set(
|
||||
'https',
|
||||
require.resolve('rollup-plugin-node-polyfills/polyfills/http'),
|
||||
)
|
||||
libs.set('os', require.resolve('rollup-plugin-node-polyfills/polyfills/os'))
|
||||
libs.set(
|
||||
'assert',
|
||||
require.resolve('rollup-plugin-node-polyfills/polyfills/assert'),
|
||||
)
|
||||
libs.set(
|
||||
'constants',
|
||||
require.resolve('rollup-plugin-node-polyfills/polyfills/constants'),
|
||||
)
|
||||
libs.set(
|
||||
'_stream_duplex',
|
||||
require.resolve(
|
||||
'rollup-plugin-node-polyfills/polyfills/readable-stream/duplex',
|
||||
),
|
||||
)
|
||||
libs.set(
|
||||
'_stream_passthrough',
|
||||
require.resolve(
|
||||
'rollup-plugin-node-polyfills/polyfills/readable-stream/passthrough',
|
||||
),
|
||||
)
|
||||
libs.set(
|
||||
'_stream_readable',
|
||||
require.resolve(
|
||||
'rollup-plugin-node-polyfills/polyfills/readable-stream/readable',
|
||||
),
|
||||
)
|
||||
libs.set(
|
||||
'_stream_writable',
|
||||
require.resolve(
|
||||
'rollup-plugin-node-polyfills/polyfills/readable-stream/writable',
|
||||
),
|
||||
)
|
||||
libs.set(
|
||||
'_stream_transform',
|
||||
require.resolve(
|
||||
'rollup-plugin-node-polyfills/polyfills/readable-stream/transform',
|
||||
),
|
||||
)
|
||||
libs.set(
|
||||
'timers',
|
||||
require.resolve('rollup-plugin-node-polyfills/polyfills/timers'),
|
||||
)
|
||||
libs.set(
|
||||
'console',
|
||||
require.resolve('rollup-plugin-node-polyfills/polyfills/console'),
|
||||
)
|
||||
libs.set('vm', require.resolve('rollup-plugin-node-polyfills/polyfills/vm'))
|
||||
libs.set(
|
||||
'zlib',
|
||||
require.resolve('rollup-plugin-node-polyfills/polyfills/zlib'),
|
||||
)
|
||||
libs.set(
|
||||
'tty',
|
||||
require.resolve('rollup-plugin-node-polyfills/polyfills/tty'),
|
||||
)
|
||||
libs.set(
|
||||
'domain',
|
||||
require.resolve('rollup-plugin-node-polyfills/polyfills/domain'),
|
||||
)
|
||||
|
||||
// not shimmed
|
||||
libs.set('dns', EMPTY_PATH)
|
||||
libs.set('dgram', EMPTY_PATH)
|
||||
libs.set('child_process', EMPTY_PATH)
|
||||
libs.set('cluster', EMPTY_PATH)
|
||||
libs.set('module', EMPTY_PATH)
|
||||
libs.set('net', EMPTY_PATH)
|
||||
libs.set('readline', EMPTY_PATH)
|
||||
libs.set('repl', EMPTY_PATH)
|
||||
libs.set('tls', EMPTY_PATH)
|
||||
libs.set('fs', EMPTY_PATH)
|
||||
libs.set('crypto', EMPTY_PATH)
|
||||
|
||||
// libs.set(
|
||||
// 'fs',
|
||||
// require.resolve('rollup-plugin-node-polyfills/polyfills/browserify-fs'),
|
||||
// )
|
||||
|
||||
// TODO enable crypto and fs https://github.com/ionic-team/rollup-plugin-node-polyfills/issues/20
|
||||
// libs.set(
|
||||
// 'crypto',
|
||||
// require.resolve(
|
||||
// 'rollup-plugin-node-polyfills/polyfills/crypto-browserify',
|
||||
// ),
|
||||
// )
|
||||
|
||||
return libs
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue