@ms-cloudpack/esm-stub-utilities 0.7.8 → 0.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -11,7 +11,7 @@ type StubImportResult = {
|
|
|
11
11
|
type: 'result';
|
|
12
12
|
/**
|
|
13
13
|
* IPC-friendly result of importing the module.
|
|
14
|
-
* Any non-IPC-
|
|
14
|
+
* Any non-IPC-friendly values (such as functions) will be pretty-printed as strings.
|
|
15
15
|
*/
|
|
16
16
|
value: unknown;
|
|
17
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tryImportStub.js","sourceRoot":"","sources":["../../src/__fixtures__/tryImportStub.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAwBxC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7D,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;AAE/D,IAAI,MAA0B,CAAC;AAE/B;;;;GAIG;AACH,MAAM,UAAU,gBAAgB;IAC9B,IAAI,MAAM;QAAE,OAAO;IAEnB,MAAM,GAAG,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC;IAEpC,sFAAsF;IACtF,yFAAyF;IACzF,uFAAuF;IACvF,2EAA2E;IAC3E,IAAI,SAA4B,CAAC;IACjC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;QACzB,SAAS,GAAG,GAAG,CAAC;IAClB,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QACzB,MAAM,IA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;QACD,MAAM,GAAG,SAAS,CAAC;KACpB;AACH,CAAC","sourcesContent":["import path from 'path';\nimport { fileURLToPath } from 'url';\nimport { Worker } from 'worker_threads';\n\n// this type is used by loadStubWorker.js\n// (it's test-specific, so no reason to put it in the types folder)\nexport type StubImportRequest = {\n stubPath: string;\n /**\n * Test function body which receives a parameter `moduleExports`.\n * The result is not returned, but this can be used to verify that an expected API is available\n * (code calling it doesn't throw) even if it doesn't show up in the named exports.\n */\n testCode?: string;\n};\n\ntype StubImportResult = {\n type: 'result';\n /**\n * IPC-friendly result of importing the module.\n * Any non-IPC-
|
|
1
|
+
{"version":3,"file":"tryImportStub.js","sourceRoot":"","sources":["../../src/__fixtures__/tryImportStub.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAwBxC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7D,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;AAE/D,IAAI,MAA0B,CAAC;AAE/B;;;;GAIG;AACH,MAAM,UAAU,gBAAgB;IAC9B,IAAI,MAAM;QAAE,OAAO;IAEnB,MAAM,GAAG,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC;IAEpC,sFAAsF;IACtF,yFAAyF;IACzF,uFAAuF;IACvF,2EAA2E;IAC3E,IAAI,SAA4B,CAAC;IACjC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;QACzB,SAAS,GAAG,GAAG,CAAC;IAClB,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QACzB,MAAM,IAAI,K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,MAAM,GAAG,SAAS,CAAC;KACpB;AACH,CAAC","sourcesContent":["import path from 'path';\nimport { fileURLToPath } from 'url';\nimport { Worker } from 'worker_threads';\n\n// this type is used by loadStubWorker.js\n// (it's test-specific, so no reason to put it in the types folder)\nexport type StubImportRequest = {\n stubPath: string;\n /**\n * Test function body which receives a parameter `moduleExports`.\n * The result is not returned, but this can be used to verify that an expected API is available\n * (code calling it doesn't throw) even if it doesn't show up in the named exports.\n */\n testCode?: string;\n};\n\ntype StubImportResult = {\n type: 'result';\n /**\n * IPC-friendly result of importing the module.\n * Any non-IPC-friendly values (such as functions) will be pretty-printed as strings.\n */\n value: unknown;\n};\nexport type StubImportResponse = StubImportResult | { type: 'error'; message: string };\n\nconst dirname = path.dirname(fileURLToPath(import.meta.url));\nconst testWorkerPath = path.join(dirname, 'loadStubWorker.js');\n\nlet worker: Worker | undefined;\n\n/**\n * Initialize a worker used for importing stubs.\n * (The worker is reused between tests for now because it's expensive to set up and tear down;\n * this can be changed later for certain tests if needed.)\n */\nexport function ensureStubWorker() {\n if (worker) return;\n\n worker = new Worker(testWorkerPath);\n\n // An 'error' event from a worker means an unhandled exception and it's about to exit.\n // Don't throw an error in this fallback handler in case the error occurred during a call\n // to `tryImportStub` (which has its own error handler that can fail the calling test),\n // but save the error to be included in the 'exit' handler's error message.\n let lastError: Error | undefined;\n worker.on('error', (err) => {\n lastError = err;\n });\n worker.on('exit', (code) => {\n throw new Error(\n lastError\n ? `Worker exited due to an uncaught exception: ${lastError.stack}`\n : `Worker exited unexpectedly with code ${code || 0}`,\n );\n });\n}\n\n/**\n * Import the stub in a worker and return the result.\n * Note that non-IPC-friendly values (such as functions) will be pretty-printed as strings.\n *\n * Why use a worker?\n * - Ensure that the module is imported in a \"vanilla\" way, without interference from Jest\n * transpilation or custom module resolution\n * - Allow the module to run in a simulated browser environment if needed\n * - Avoid potential pollution of the current process's globals\n *\n * (The worker is reused between tests for now because it's expensive to set up and tear down;\n * this can be changed later for certain tests if needed.)\n */\nexport async function tryImportStub(params: StubImportRequest): Promise<unknown> {\n ensureStubWorker();\n\n return new Promise((resolve, reject) => {\n const onMessage = (response: StubImportResponse) => {\n worker?.off('error', onError);\n if (response.type === 'error') {\n // error importing the module\n reject(response.message);\n } else {\n resolve(response.value);\n }\n };\n // unhandled exception (not expected)\n const onError = (err: Error) => {\n worker?.off('message', onMessage);\n reject(err);\n };\n worker?.once('message', onMessage);\n worker?.once('error', onError);\n\n worker?.postMessage(params);\n });\n}\n\nexport async function cleanUpStubWorker() {\n if (worker) {\n // Remove all listeners so that the exit handler set up during initialization doesn't throw\n worker.removeAllListeners();\n try {\n await worker.terminate();\n } catch {\n // ignore\n }\n worker = undefined;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initBrowserEnvironment.d.ts","sourceRoot":"","sources":["../../src/worker/initBrowserEnvironment.js"],"names":[],"mappings":"AAOA;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"initBrowserEnvironment.d.ts","sourceRoot":"","sources":["../../src/worker/initBrowserEnvironment.js"],"names":[],"mappings":"AAOA;;GAEG;AACH,wDAoEC"}
|
|
@@ -63,5 +63,7 @@ export async function initBrowserEnvironment() {
|
|
|
63
63
|
window.fetch = /** @type {*} */ (async () => { });
|
|
64
64
|
// prevent 'debug' package from accessing process.stderr
|
|
65
65
|
process.env.DEBUG_COLORS = '0';
|
|
66
|
+
// Some packages like readable-stream@2.3.7 read process.browser to avoid node code
|
|
67
|
+
/** @type {*} */ (process).browser = true;
|
|
66
68
|
}
|
|
67
69
|
//# sourceMappingURL=initBrowserEnvironment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initBrowserEnvironment.js","sourceRoot":"","sources":["../../src/worker/initBrowserEnvironment.js"],"names":[],"mappings":"AAAA,2CAA2C;AAE3C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,WAAW,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AAgB,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa;gBACrC,CAAC,qBAAqB,CAAC,OAAO,EAAE,qCAAqC,CAAC,OAAO,EAAE,EAAE;oBAC/E,IAAI,OAAO,KAAK,QAAQ,EAAE;wBACxB,OAAO,gBAAgB,CAAC,CAAC;4BACvB,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;gCACjB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;6BACnB,CAAC;4BACF,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;yBACxB,CAAC,CAAC;qBACJ;oBAED,OAAO,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;gBAClE,CAAC,CAAC;IAEN,MAAM,CAAC,KAAK,GAAG,gBAAgB,CAAC,CAAC,KAAK,IAAI,EAAE,GAAE,CAAC,CAAC,CAAC;IAEjD,wDAAwD;IACxD,OAAO,CAAC,GAAG,CAAC,YAAY,GAAG,GAAG,CAAC;IAE/B,mFAAmF;IACnF,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC;AAC5C,CAAC","sourcesContent":["// See worker.js for why this is a JS file.\n\nimport btoa from 'btoa';\nimport atob from 'atob';\nimport { performance } from 'perf_hooks';\nimport util from 'util';\n\n/**\n * Initialize a fake browser environment.\n */\nexport async function initBrowserEnvironment() {\n // These must be set up before JSDOM\n !global.performance && (global.performance = /** @type {*} */ (performance));\n !global.TextEncoder && (global.TextEncoder = util.TextEncoder);\n !global.TextDecoder && (global.TextDecoder = /** @type {*} */ (util.TextDecoder));\n\n (await import('jsdom-global')).default();\n\n await import('regenerator-runtime');\n\n // Ensure assigning to and reading from `window.foo` globals works as expected by copying all the\n // properties from the jsdom `window` to node's `global`, then assigning `global` to `window`.\n Object.entries(Object.getOwnPropertyDescriptors(window)).forEach(([k, desc]) => {\n // Skip storage to avoid errors \"localStorage is not available for opaque origins\"\n // (these errors could in theory be resolved by passing a URL to jsdom-global setup, but that\n // triggers some weird issues with whatwg-url using TextDecoder in a way that works in other\n // environments but throws in the sandbox)\n if (!(k in global) && !['localStorage', 'sessionStorage'].includes(k)) {\n Object.defineProperty(global, k, desc);\n }\n });\n /** @type {*} */ (global).window = global;\n /** @type {*} */ (global).self = global;\n /** @type {*} */ (document).window = global;\n\n window.requestAnimationFrame = window.setTimeout;\n window.cancelAnimationFrame = window.clearTimeout;\n global.btoa = btoa;\n global.atob = atob;\n\n // Simulate WebSocket existence. (Needed for isomorphic-ws)\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n global.WebSocket = window.WebSocket = /** @type {*} */ (class WebSocket {});\n\n // Fake MessageChannel so scheduler won't hang the process by opening a channel.\n global.MessageChannel = window.MessageChannel = class MessageChannel {\n port1 = /** @type {*} */ ({});\n port2 = /** @type {*} */ ({});\n };\n\n // eslint-disable-next-line etc/no-deprecated\n const createElement = window.document.createElement.bind(window.document);\n\n // Mock out canvas.\n // eslint-disable-next-line etc/no-deprecated\n global.document.createElement =\n /** @type {*} */ (window).createElement =\n /** @type {*} */ (global).createElement =\n (/** @type {string} */ tagName, /** @type {ElementCreationOptions} */ options) => {\n if (tagName === 'canvas') {\n return /** @type {*} */ ({\n getContext: () => ({\n fillRect: () => {},\n }),\n measureText: () => ({}),\n });\n }\n\n return createElement.apply(window.document, [tagName, options]);\n };\n\n window.fetch = /** @type {*} */ (async () => {});\n\n // prevent 'debug' package from accessing process.stderr\n process.env.DEBUG_COLORS = '0';\n\n // Some packages like readable-stream@2.3.7 read process.browser to avoid node code\n /** @type {*} */ (process).browser = true;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/esm-stub-utilities",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.10",
|
|
4
4
|
"description": "Generates ESM stubs for CommonJS entry files.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@ms-cloudpack/json-utilities": "^0.1.
|
|
17
|
+
"@ms-cloudpack/json-utilities": "^0.1.2",
|
|
18
18
|
"@ms-cloudpack/path-utilities": "^2.3.5",
|
|
19
19
|
"@ms-cloudpack/path-string-parsing": "^1.1.1",
|
|
20
20
|
"atob": "^2.1.2",
|