@jsenv/core 36.1.0 → 36.1.2
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/jsenv_core.js +174 -3913
- package/package.json +2 -4
- package/src/build/build.js +1 -1
- package/src/dev/file_service.js +15 -5
- package/src/kitchen/errors.js +11 -4
- package/src/plugins/transpilation/js_module_fallback/jsenv_plugin_js_module_conversion.js +1 -1
- package/src/plugins/transpilation/js_module_fallback/jsenv_plugin_js_module_fallback.js +2 -1
- package/dist/js/s.js +0 -590
- package/dist/js/s.js.map +0 -239
- package/src/plugins/transpilation/js_module_fallback/async-to-promises.js +0 -3860
- package/src/plugins/transpilation/js_module_fallback/client/s.js +0 -449
- package/src/plugins/transpilation/js_module_fallback/convert_js_module_to_js_classic.js +0 -175
- package/src/plugins/transpilation/js_module_fallback/helpers/babel_plugin_transform_import_meta_resolve.js +0 -26
- package/src/plugins/transpilation/js_module_fallback/helpers/babel_plugin_transform_import_meta_url.js +0 -47
- package/src/plugins/transpilation/js_module_fallback/helpers/systemjs_old.js +0 -43
- package/src/plugins/transpilation/js_module_fallback/helpers-string.js +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "36.1.
|
|
3
|
+
"version": "36.1.2",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -57,9 +57,6 @@
|
|
|
57
57
|
"prepublishOnly": "npm run build"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@babel/plugin-proposal-dynamic-import": "7.18.6",
|
|
61
|
-
"@babel/plugin-transform-modules-systemjs": "7.20.11",
|
|
62
|
-
"@babel/plugin-transform-modules-umd": "7.18.6",
|
|
63
60
|
"@financial-times/polyfill-useragent-normaliser": "1.10.2",
|
|
64
61
|
"@jsenv/abort": "4.2.4",
|
|
65
62
|
"@jsenv/ast": "4.0.0",
|
|
@@ -70,6 +67,7 @@
|
|
|
70
67
|
"@jsenv/log": "3.3.5",
|
|
71
68
|
"@jsenv/node-esm-resolution": "1.0.1",
|
|
72
69
|
"@jsenv/plugin-supervisor": "1.0.0",
|
|
70
|
+
"@jsenv/js-module-fallback": "1.0.0",
|
|
73
71
|
"@jsenv/server": "15.0.3",
|
|
74
72
|
"@jsenv/sourcemap": "1.0.10",
|
|
75
73
|
"@jsenv/url-meta": "8.1.0",
|
package/src/build/build.js
CHANGED
package/src/dev/file_service.js
CHANGED
|
@@ -254,7 +254,11 @@ export const createFileService = ({
|
|
|
254
254
|
return responseFromPlugin;
|
|
255
255
|
}
|
|
256
256
|
let reference;
|
|
257
|
-
const parentUrl = inferParentFromRequest(
|
|
257
|
+
const parentUrl = inferParentFromRequest(
|
|
258
|
+
request,
|
|
259
|
+
sourceDirectoryUrl,
|
|
260
|
+
sourceMainFilePath,
|
|
261
|
+
);
|
|
258
262
|
if (parentUrl) {
|
|
259
263
|
reference = urlGraph.inferReference(request.resource, parentUrl);
|
|
260
264
|
}
|
|
@@ -425,15 +429,21 @@ export const createFileService = ({
|
|
|
425
429
|
};
|
|
426
430
|
};
|
|
427
431
|
|
|
428
|
-
const inferParentFromRequest = (
|
|
432
|
+
const inferParentFromRequest = (
|
|
433
|
+
request,
|
|
434
|
+
sourceDirectoryUrl,
|
|
435
|
+
sourceMainFilePath,
|
|
436
|
+
) => {
|
|
429
437
|
const { referer } = request.headers;
|
|
430
438
|
if (!referer) {
|
|
431
439
|
return null;
|
|
432
440
|
}
|
|
433
441
|
const refererUrlObject = new URL(referer);
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
442
|
+
const refererUrl =
|
|
443
|
+
refererUrlObject.pathname === `/`
|
|
444
|
+
? new URL(sourceMainFilePath, request.origin).href
|
|
445
|
+
: referer;
|
|
446
|
+
return WEB_URL_CONVERTER.asFileUrl(refererUrl, {
|
|
437
447
|
origin: request.origin,
|
|
438
448
|
rootDirectoryUrl: sourceDirectoryUrl,
|
|
439
449
|
});
|
package/src/kitchen/errors.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { pathToFileURL } from "node:url";
|
|
1
2
|
import { createDetailedMessage } from "@jsenv/log";
|
|
2
3
|
import { stringifyUrlSite } from "@jsenv/urls";
|
|
3
4
|
|
|
@@ -95,10 +96,16 @@ export const createFetchUrlContentError = ({
|
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
98
|
if (error.code === "ENOENT") {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
const urlTried = pathToFileURL(error.path).href;
|
|
100
|
+
// ensure ENOENT is caused by trying to read the urlInfo.url
|
|
101
|
+
// any ENOENT trying to read an other file should display the error.stack
|
|
102
|
+
// because it means some side logic has failed
|
|
103
|
+
if (urlInfo.url.startsWith(urlTried)) {
|
|
104
|
+
return createFailedToFetchUrlContentError({
|
|
105
|
+
code: "NOT_FOUND",
|
|
106
|
+
reason: "no entry on filesystem",
|
|
107
|
+
});
|
|
108
|
+
}
|
|
102
109
|
}
|
|
103
110
|
if (error.code === "PARSE_ERROR") {
|
|
104
111
|
return createFailedToFetchUrlContentError({
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { injectQueryParams } from "@jsenv/urls";
|
|
7
|
-
import { convertJsModuleToJsClassic } from "
|
|
7
|
+
import { convertJsModuleToJsClassic } from "@jsenv/js-module-fallback";
|
|
8
8
|
|
|
9
9
|
export const jsenvPluginJsModuleConversion = ({
|
|
10
10
|
systemJsInjection,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { urlToFilename } from "@jsenv/urls";
|
|
2
|
-
import { systemJsClientFileUrlDefault } from "
|
|
2
|
+
import { systemJsClientFileUrlDefault } from "@jsenv/js-module-fallback";
|
|
3
|
+
|
|
3
4
|
import { jsenvPluginJsModuleConversion } from "./jsenv_plugin_js_module_conversion.js";
|
|
4
5
|
import { jsenvPluginJsModuleFallbackInsideHtml } from "./jsenv_plugin_js_module_fallback_inside_html.js";
|
|
5
6
|
import { jsenvPluginJsModuleFallbackOnWorkers } from "./jsenv_plugin_js_module_fallback_on_workers.js";
|