@jsenv/core 36.1.1 → 36.1.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "36.1.1",
3
+ "version": "36.1.3",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -16,8 +16,7 @@
16
16
  "node": ">=18.5.0"
17
17
  },
18
18
  "publishConfig": {
19
- "access": "public",
20
- "registry": "https://registry.npmjs.org"
19
+ "access": "public"
21
20
  },
22
21
  "type": "module",
23
22
  "imports": {},
@@ -36,8 +35,10 @@
36
35
  "/src/"
37
36
  ],
38
37
  "workspaces": [
39
- "./packages/*",
40
- "./packages/create-jsenv/*"
38
+ "./packages/internal/*",
39
+ "./packages/plugins/*",
40
+ "./packages/rest/*",
41
+ "./packages/rest/create-jsenv/*"
41
42
  ],
42
43
  "scripts": {
43
44
  "eslint": "npx eslint . --ext=.js,.mjs,.cjs,.html",
@@ -57,19 +58,17 @@
57
58
  "prepublishOnly": "npm run build"
58
59
  },
59
60
  "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
61
  "@financial-times/polyfill-useragent-normaliser": "1.10.2",
64
62
  "@jsenv/abort": "4.2.4",
65
- "@jsenv/ast": "4.0.0",
63
+ "@jsenv/ast": "4.0.2",
66
64
  "@jsenv/babel-plugins": "1.1.6",
67
65
  "@jsenv/filesystem": "4.2.3",
68
66
  "@jsenv/importmap": "1.2.1",
69
67
  "@jsenv/integrity": "0.0.1",
70
68
  "@jsenv/log": "3.3.5",
71
69
  "@jsenv/node-esm-resolution": "1.0.1",
72
- "@jsenv/plugin-supervisor": "1.0.0",
70
+ "@jsenv/plugin-supervisor": "1.0.1",
71
+ "@jsenv/js-module-fallback": "1.0.1",
73
72
  "@jsenv/server": "15.0.3",
74
73
  "@jsenv/sourcemap": "1.0.10",
75
74
  "@jsenv/url-meta": "8.1.0",
@@ -81,21 +80,23 @@
81
80
  "devDependencies": {
82
81
  "@babel/eslint-parser": "7.21.8",
83
82
  "@babel/plugin-syntax-import-assertions": "7.20.0",
84
- "@jsenv/assert": "./packages/assert/",
85
- "@jsenv/eslint-config": "./packages/eslint-config/",
83
+ "@jsenv/assert": "./packages/rest/assert/",
84
+ "@jsenv/eslint-config": "./packages/rest/eslint-config/",
86
85
  "@jsenv/file-size-impact": "14.1.1",
86
+ "@jsenv/core": "./",
87
87
  "@jsenv/https-local": "3.0.6",
88
88
  "@jsenv/package-workspace": "0.5.2",
89
89
  "@jsenv/performance-impact": "4.1.1",
90
- "@jsenv/plugin-globals": "./packages/jsenv-plugin-globals/",
91
- "@jsenv/plugin-minification": "./packages/jsenv-plugin-minification/",
92
- "@jsenv/plugin-placeholders": "./packages/jsenv-plugin-placeholders/",
93
- "@jsenv/plugin-as-js-classic": "./packages/jsenv-plugin-as-js-classic/",
94
- "@jsenv/test": "./packages/test/",
90
+ "@jsenv/plugin-globals": "./packages/plugins/jsenv-plugin-globals/",
91
+ "@jsenv/plugin-minification": "./packages/plugins/jsenv-plugin-minification/",
92
+ "@jsenv/plugin-placeholders": "./packages/plugins/jsenv-plugin-placeholders/",
93
+ "@jsenv/plugin-as-js-classic": "./packages/plugins/jsenv-plugin-as-js-classic/",
94
+ "@jsenv/test": "./packages/rest/test/",
95
95
  "eslint": "8.41.0",
96
96
  "eslint-plugin-html": "7.1.0",
97
97
  "eslint-plugin-import": "2.27.5",
98
98
  "eslint-plugin-react": "7.32.2",
99
+ "open": "9.1.0",
99
100
  "playwright": "1.34.2",
100
101
  "prettier": "2.8.8"
101
102
  }
@@ -407,7 +407,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
407
407
  }),
408
408
  jsenvPluginInlining(),
409
409
  {
410
- name: "jsenv:build",
410
+ name: "jsenv:build_shape",
411
411
  appliesDuring: "build",
412
412
  resolveReference: (reference) => {
413
413
  const getUrl = () => {
@@ -439,13 +439,10 @@ const inferParentFromRequest = (
439
439
  return null;
440
440
  }
441
441
  const refererUrlObject = new URL(referer);
442
- refererUrlObject.searchParams.delete("hmr");
443
- refererUrlObject.searchParams.delete("v");
444
-
445
- let refererUrl = refererUrlObject.href;
446
- if (refererUrl === `${request.origin}/`) {
447
- refererUrl = new URL(sourceMainFilePath, request.origin).href;
448
- }
442
+ const refererUrl =
443
+ refererUrlObject.pathname === `/`
444
+ ? new URL(sourceMainFilePath, request.origin).href
445
+ : referer;
449
446
  return WEB_URL_CONVERTER.asFileUrl(refererUrl, {
450
447
  origin: request.origin,
451
448
  rootDirectoryUrl: sourceDirectoryUrl,
@@ -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
- return createFailedToFetchUrlContentError({
99
- code: "NOT_FOUND",
100
- reason: "no entry on filesystem",
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 "./convert_js_module_to_js_classic.js";
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 "./convert_js_module_to_js_classic.js";
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";