unrun 0.2.3 → 0.2.4
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.
package/dist/index.d.mts
CHANGED
|
@@ -10,7 +10,7 @@ interface Options {
|
|
|
10
10
|
/**
|
|
11
11
|
* Debug mode.
|
|
12
12
|
* Wether or not to keep temporary files to help with debugging.
|
|
13
|
-
* Temporary files are stored in `node_modules/.
|
|
13
|
+
* Temporary files are stored in `node_modules/.unrun/` if possible,
|
|
14
14
|
* otherwise in the OS temporary directory.
|
|
15
15
|
* @default false
|
|
16
16
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -373,7 +373,7 @@ async function bundle(options) {
|
|
|
373
373
|
const inputOptions = {
|
|
374
374
|
input: options.path,
|
|
375
375
|
platform: "node",
|
|
376
|
-
external: (id) => !id.startsWith(".") && !
|
|
376
|
+
external: (id) => !id.startsWith(".") && !path.isAbsolute(id) && !id.startsWith("#"),
|
|
377
377
|
plugins: [
|
|
378
378
|
createMakeCjsWrapperAsyncFriendlyPlugin(),
|
|
379
379
|
createRequireResolveFix(options),
|
|
@@ -413,8 +413,10 @@ async function bundle(options) {
|
|
|
413
413
|
* Clean the module file at the given URL.
|
|
414
414
|
* Deletes the file if it exists.
|
|
415
415
|
* @param moduleUrl - The URL of the module file to be cleaned.
|
|
416
|
+
* @param options - Resolved options.
|
|
416
417
|
*/
|
|
417
|
-
function cleanModule(moduleUrl) {
|
|
418
|
+
function cleanModule(moduleUrl, options) {
|
|
419
|
+
if (options.debug) return;
|
|
418
420
|
try {
|
|
419
421
|
if (moduleUrl.startsWith("file://")) {
|
|
420
422
|
const filePath = new URL(moduleUrl);
|
|
@@ -523,7 +525,7 @@ async function loadModule(code, options) {
|
|
|
523
525
|
try {
|
|
524
526
|
_module = await import(moduleUrl);
|
|
525
527
|
} finally {
|
|
526
|
-
cleanModule(moduleUrl);
|
|
528
|
+
cleanModule(moduleUrl, options);
|
|
527
529
|
}
|
|
528
530
|
return _module;
|
|
529
531
|
}
|
|
@@ -575,7 +577,7 @@ async function unrunCli(options, args = []) {
|
|
|
575
577
|
} catch (error) {
|
|
576
578
|
throw new Error(`[unrun] Run failed (code length: ${outputChunk.code.length}): ${error.message}`);
|
|
577
579
|
}
|
|
578
|
-
cleanModule(moduleUrl);
|
|
580
|
+
cleanModule(moduleUrl, resolvedOptions);
|
|
579
581
|
return cliResult;
|
|
580
582
|
}
|
|
581
583
|
|
package/dist/sync/worker.mjs
CHANGED