@jsenv/core 39.3.10 → 39.3.12
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
CHANGED
|
@@ -1465,7 +1465,7 @@ const isValidUrl$1 = (url) => {
|
|
|
1465
1465
|
// eslint-disable-next-line no-new
|
|
1466
1466
|
new URL(url);
|
|
1467
1467
|
return true;
|
|
1468
|
-
} catch
|
|
1468
|
+
} catch {
|
|
1469
1469
|
return false;
|
|
1470
1470
|
}
|
|
1471
1471
|
};
|
|
@@ -1826,7 +1826,7 @@ const validateDirectoryUrl = (value) => {
|
|
|
1826
1826
|
} else {
|
|
1827
1827
|
try {
|
|
1828
1828
|
urlString = String(new URL(value));
|
|
1829
|
-
} catch
|
|
1829
|
+
} catch {
|
|
1830
1830
|
return {
|
|
1831
1831
|
valid: false,
|
|
1832
1832
|
value,
|
|
@@ -1834,6 +1834,12 @@ const validateDirectoryUrl = (value) => {
|
|
|
1834
1834
|
};
|
|
1835
1835
|
}
|
|
1836
1836
|
}
|
|
1837
|
+
} else if (
|
|
1838
|
+
value &&
|
|
1839
|
+
typeof value === "object" &&
|
|
1840
|
+
typeof value.href === "string"
|
|
1841
|
+
) {
|
|
1842
|
+
value = value.href;
|
|
1837
1843
|
} else {
|
|
1838
1844
|
return {
|
|
1839
1845
|
valid: false,
|
|
@@ -1876,7 +1882,7 @@ const validateFileUrl = (value, baseUrl) => {
|
|
|
1876
1882
|
} else {
|
|
1877
1883
|
try {
|
|
1878
1884
|
urlString = String(new URL(value, baseUrl));
|
|
1879
|
-
} catch
|
|
1885
|
+
} catch {
|
|
1880
1886
|
return {
|
|
1881
1887
|
valid: false,
|
|
1882
1888
|
value,
|
|
@@ -1987,7 +1993,7 @@ const baseUrlFallback = fileSystemPathToUrl$1(process.cwd());
|
|
|
1987
1993
|
const ensureWindowsDriveLetter = (url, baseUrl) => {
|
|
1988
1994
|
try {
|
|
1989
1995
|
url = String(new URL(url));
|
|
1990
|
-
} catch
|
|
1996
|
+
} catch {
|
|
1991
1997
|
throw new Error(`absolute url expect but got ${url}`);
|
|
1992
1998
|
}
|
|
1993
1999
|
|
|
@@ -1997,7 +2003,7 @@ const ensureWindowsDriveLetter = (url, baseUrl) => {
|
|
|
1997
2003
|
|
|
1998
2004
|
try {
|
|
1999
2005
|
baseUrl = String(new URL(baseUrl));
|
|
2000
|
-
} catch
|
|
2006
|
+
} catch {
|
|
2001
2007
|
throw new Error(
|
|
2002
2008
|
`absolute baseUrl expect but got ${baseUrl} to ensure windows drive letter on ${url}`,
|
|
2003
2009
|
);
|
|
@@ -2847,7 +2853,7 @@ const resolveAssociations = (associations, baseUrl) => {
|
|
|
2847
2853
|
let patternResolved;
|
|
2848
2854
|
try {
|
|
2849
2855
|
patternResolved = String(new URL(pattern, baseUrl));
|
|
2850
|
-
} catch
|
|
2856
|
+
} catch {
|
|
2851
2857
|
// it's not really an url, no need to perform url resolution nor encoding
|
|
2852
2858
|
patternResolved = pattern;
|
|
2853
2859
|
}
|
|
@@ -7826,7 +7832,7 @@ const getMtimeResponse = async ({ headers, sourceStat }) => {
|
|
|
7826
7832
|
let cachedModificationDate;
|
|
7827
7833
|
try {
|
|
7828
7834
|
cachedModificationDate = new Date(headers["if-modified-since"]);
|
|
7829
|
-
} catch
|
|
7835
|
+
} catch {
|
|
7830
7836
|
return {
|
|
7831
7837
|
status: 400,
|
|
7832
7838
|
statusText: "if-modified-since header is not a valid date",
|
|
@@ -7928,7 +7934,7 @@ const asUrlString = (value) => {
|
|
|
7928
7934
|
try {
|
|
7929
7935
|
const urlObject = new URL(value);
|
|
7930
7936
|
return String(urlObject);
|
|
7931
|
-
} catch
|
|
7937
|
+
} catch {
|
|
7932
7938
|
return null;
|
|
7933
7939
|
}
|
|
7934
7940
|
}
|
|
@@ -9606,7 +9612,6 @@ const babelPluginBabelHelpersAsJsenvImports = (
|
|
|
9606
9612
|
};
|
|
9607
9613
|
};
|
|
9608
9614
|
|
|
9609
|
-
/* eslint-disable camelcase */
|
|
9610
9615
|
// copied from
|
|
9611
9616
|
// https://github.com/babel/babel/blob/e498bee10f0123bb208baa228ce6417542a2c3c4/packages/babel-compat-data/data/plugins.json#L1
|
|
9612
9617
|
// https://github.com/babel/babel/blob/master/packages/babel-compat-data/data/plugins.json#L1
|
|
@@ -17104,20 +17109,44 @@ const jsenvPluginInlineContentFetcher = () => {
|
|
|
17104
17109
|
if (!urlInfo.isInline) {
|
|
17105
17110
|
return null;
|
|
17106
17111
|
}
|
|
17107
|
-
|
|
17108
|
-
|
|
17109
|
-
|
|
17112
|
+
let isDirectRequestToFile;
|
|
17113
|
+
if (urlInfo.context.request) {
|
|
17114
|
+
const requestedUrl = new URL(
|
|
17115
|
+
urlInfo.context.request.resource.slice(1),
|
|
17116
|
+
urlInfo.context.rootDirectoryUrl,
|
|
17117
|
+
).href;
|
|
17118
|
+
isDirectRequestToFile = requestedUrl === urlInfo.url;
|
|
17119
|
+
}
|
|
17120
|
+
/*
|
|
17121
|
+
* We want to find inline content but it's not straightforward
|
|
17122
|
+
*
|
|
17123
|
+
* For some reason (that would be great to investigate)
|
|
17124
|
+
* urlInfo corresponding to inline content has several referenceFromOthersSet
|
|
17125
|
+
* so the latest version is the last reference
|
|
17126
|
+
* BUT the last reference is the "http_request"
|
|
17127
|
+
* so it's more likely the before last reference that contains the latest version
|
|
17128
|
+
*
|
|
17129
|
+
* BUT the is an exception when using supervisor as the before last reference
|
|
17130
|
+
* is the one fetched by the browser that is already cooked
|
|
17131
|
+
* we must re-cook from the original content, not from the already cooked content
|
|
17132
|
+
* Otherwise references are already resolved and
|
|
17133
|
+
* - "/node_modules/package/file.js" instead of "package/file.js"
|
|
17134
|
+
* - meaning we would not create the implicit dependency to package.json
|
|
17135
|
+
* - resulting in a reload of the browser (as implicit reference to package.json is gone)
|
|
17136
|
+
* -> can create infinite loop of reloads
|
|
17137
|
+
*/
|
|
17110
17138
|
let lastInlineReference;
|
|
17111
17139
|
let originalContent = urlInfo.originalContent;
|
|
17112
17140
|
for (const reference of urlInfo.referenceFromOthersSet) {
|
|
17113
|
-
if (reference.isInline) {
|
|
17114
|
-
|
|
17115
|
-
|
|
17116
|
-
|
|
17117
|
-
|
|
17118
|
-
|
|
17119
|
-
|
|
17120
|
-
|
|
17141
|
+
if (!reference.isInline) {
|
|
17142
|
+
continue;
|
|
17143
|
+
}
|
|
17144
|
+
if (urlInfo.originalContent === undefined) {
|
|
17145
|
+
originalContent = reference.content;
|
|
17146
|
+
}
|
|
17147
|
+
lastInlineReference = reference;
|
|
17148
|
+
if (isDirectRequestToFile) {
|
|
17149
|
+
break;
|
|
17121
17150
|
}
|
|
17122
17151
|
}
|
|
17123
17152
|
const { prev } = lastInlineReference;
|
|
@@ -17139,12 +17168,6 @@ const jsenvPluginInlineContentFetcher = () => {
|
|
|
17139
17168
|
return {
|
|
17140
17169
|
originalContent,
|
|
17141
17170
|
content:
|
|
17142
|
-
// we must favor original content to re-apply the same plugin logic
|
|
17143
|
-
// so that the same references are generated
|
|
17144
|
-
// without this we would try to resolve references like
|
|
17145
|
-
// "/node_modules/package/file.js" instead of "package/file.js"
|
|
17146
|
-
// meaning we would not create the implicit dependency to package.json
|
|
17147
|
-
// resulting in a reload of the browser (as implicit reference to package.json is gone)
|
|
17148
17171
|
originalContent === undefined
|
|
17149
17172
|
? lastInlineReference.content
|
|
17150
17173
|
: originalContent,
|
|
@@ -17209,7 +17232,7 @@ const isValidUrl = (url) => {
|
|
|
17209
17232
|
// eslint-disable-next-line no-new
|
|
17210
17233
|
new URL(url);
|
|
17211
17234
|
return true;
|
|
17212
|
-
} catch
|
|
17235
|
+
} catch {
|
|
17213
17236
|
return false;
|
|
17214
17237
|
}
|
|
17215
17238
|
};
|
|
@@ -17257,7 +17280,7 @@ const defaultReadPackageJson = (packageUrl) => {
|
|
|
17257
17280
|
const string = String(buffer);
|
|
17258
17281
|
try {
|
|
17259
17282
|
return JSON.parse(string);
|
|
17260
|
-
} catch
|
|
17283
|
+
} catch {
|
|
17261
17284
|
throw new Error(`Invalid package configuration`);
|
|
17262
17285
|
}
|
|
17263
17286
|
};
|
|
@@ -17505,7 +17528,7 @@ const applyPackageSpecifierResolution = (specifier, resolutionContext) => {
|
|
|
17505
17528
|
type: "absolute_specifier",
|
|
17506
17529
|
url: urlObject.href,
|
|
17507
17530
|
};
|
|
17508
|
-
} catch
|
|
17531
|
+
} catch {
|
|
17509
17532
|
// bare specifier
|
|
17510
17533
|
const browserFieldResolution = applyBrowserFieldResolution(
|
|
17511
17534
|
specifier,
|
|
@@ -20495,7 +20518,6 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
|
|
|
20495
20518
|
extension = extensionMappings[extension] || extension;
|
|
20496
20519
|
let nameCandidate = `${basename}${extension}`; // reconstruct name in case extension was normalized
|
|
20497
20520
|
let integer = 1;
|
|
20498
|
-
// eslint-disable-next-line no-constant-condition
|
|
20499
20521
|
while (true) {
|
|
20500
20522
|
if (!names.includes(nameCandidate)) {
|
|
20501
20523
|
names.push(nameCandidate);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "39.3.
|
|
3
|
+
"version": "39.3.12",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"./packages/related/cli/*"
|
|
44
44
|
],
|
|
45
45
|
"scripts": {
|
|
46
|
-
"eslint": "npx eslint .
|
|
46
|
+
"eslint": "npx eslint .",
|
|
47
47
|
"test": "node --conditions=development ./scripts/test/test.mjs",
|
|
48
48
|
"build": "node --conditions=development ./scripts/build/build.mjs",
|
|
49
49
|
"workspace:test": "npm run test --workspaces --if-present -- --workspace",
|
|
@@ -69,18 +69,18 @@
|
|
|
69
69
|
"@financial-times/polyfill-useragent-normaliser": "1.10.2",
|
|
70
70
|
"@jsenv/abort": "4.3.0",
|
|
71
71
|
"@jsenv/ast": "6.2.16",
|
|
72
|
-
"@jsenv/filesystem": "4.10.
|
|
72
|
+
"@jsenv/filesystem": "4.10.2",
|
|
73
73
|
"@jsenv/humanize": "1.2.8",
|
|
74
74
|
"@jsenv/importmap": "1.2.1",
|
|
75
75
|
"@jsenv/integrity": "0.0.2",
|
|
76
76
|
"@jsenv/js-module-fallback": "1.3.37",
|
|
77
|
-
"@jsenv/node-esm-resolution": "1.0.
|
|
77
|
+
"@jsenv/node-esm-resolution": "1.0.6",
|
|
78
78
|
"@jsenv/plugin-bundling": "2.7.7",
|
|
79
79
|
"@jsenv/plugin-minification": "1.5.5",
|
|
80
80
|
"@jsenv/plugin-supervisor": "1.5.18",
|
|
81
81
|
"@jsenv/plugin-transpilation": "1.4.21",
|
|
82
82
|
"@jsenv/runtime-compat": "1.3.1",
|
|
83
|
-
"@jsenv/server": "15.
|
|
83
|
+
"@jsenv/server": "15.3.0",
|
|
84
84
|
"@jsenv/sourcemap": "1.2.23",
|
|
85
85
|
"@jsenv/url-meta": "8.5.1",
|
|
86
86
|
"@jsenv/urls": "2.5.2",
|
|
@@ -91,6 +91,7 @@
|
|
|
91
91
|
"@babel/eslint-parser": "7.25.1",
|
|
92
92
|
"@babel/plugin-syntax-import-attributes": "7.24.7",
|
|
93
93
|
"@babel/plugin-syntax-optional-chaining-assign": "7.24.7",
|
|
94
|
+
"@eslint/compat": "1.1.1",
|
|
94
95
|
"@jsenv/assert": "./packages/independent/assert/",
|
|
95
96
|
"@jsenv/cli": "./packages/related/cli/",
|
|
96
97
|
"@jsenv/core": "./",
|
|
@@ -102,18 +103,14 @@
|
|
|
102
103
|
"@jsenv/plugin-as-js-classic": "./packages/related/plugin-as-js-classic/",
|
|
103
104
|
"@jsenv/snapshot": "./packages/independent/snapshot/",
|
|
104
105
|
"@jsenv/test": "./packages/related/test/",
|
|
105
|
-
"@playwright/browser-chromium": "1.
|
|
106
|
-
"@playwright/browser-firefox": "1.
|
|
107
|
-
"@playwright/browser-webkit": "1.
|
|
106
|
+
"@playwright/browser-chromium": "1.46.0",
|
|
107
|
+
"@playwright/browser-firefox": "1.46.0",
|
|
108
|
+
"@playwright/browser-webkit": "1.46.0",
|
|
108
109
|
"babel-plugin-transform-async-to-promises": "0.8.18",
|
|
109
|
-
"eslint": "8.
|
|
110
|
-
"
|
|
111
|
-
"eslint-plugin-import": "2.29.1",
|
|
112
|
-
"eslint-plugin-react": "7.35.0",
|
|
113
|
-
"eslint-plugin-regexp": "2.6.0",
|
|
114
|
-
"marked": "13.0.3",
|
|
110
|
+
"eslint": "9.8.0",
|
|
111
|
+
"marked": "14.0.0",
|
|
115
112
|
"open": "10.1.0",
|
|
116
|
-
"playwright": "1.
|
|
113
|
+
"playwright": "1.46.0",
|
|
117
114
|
"prettier": "3.3.3",
|
|
118
115
|
"prettier-plugin-organize-imports": "4.0.0",
|
|
119
116
|
"strip-ansi": "7.1.0"
|
|
@@ -69,7 +69,6 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
|
|
|
69
69
|
extension = extensionMappings[extension] || extension;
|
|
70
70
|
let nameCandidate = `${basename}${extension}`; // reconstruct name in case extension was normalized
|
|
71
71
|
let integer = 1;
|
|
72
|
-
// eslint-disable-next-line no-constant-condition
|
|
73
72
|
while (true) {
|
|
74
73
|
if (!names.includes(nameCandidate)) {
|
|
75
74
|
names.push(nameCandidate);
|
package/src/kitchen/kitchen.js
CHANGED
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
urlIsInsideOf,
|
|
10
10
|
} from "@jsenv/urls";
|
|
11
11
|
import { CONTENT_TYPE } from "@jsenv/utils/src/content_type/content_type.js";
|
|
12
|
-
|
|
13
12
|
import { jsenvPluginHtmlSyntaxErrorFallback } from "../plugins/html_syntax_error_fallback/jsenv_plugin_html_syntax_error_fallback.js";
|
|
14
13
|
import { createPluginController } from "../plugins/plugin_controller.js";
|
|
15
14
|
import {
|
|
@@ -41,20 +41,44 @@ const jsenvPluginInlineContentFetcher = () => {
|
|
|
41
41
|
if (!urlInfo.isInline) {
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
let isDirectRequestToFile;
|
|
45
|
+
if (urlInfo.context.request) {
|
|
46
|
+
const requestedUrl = new URL(
|
|
47
|
+
urlInfo.context.request.resource.slice(1),
|
|
48
|
+
urlInfo.context.rootDirectoryUrl,
|
|
49
|
+
).href;
|
|
50
|
+
isDirectRequestToFile = requestedUrl === urlInfo.url;
|
|
51
|
+
}
|
|
52
|
+
/*
|
|
53
|
+
* We want to find inline content but it's not straightforward
|
|
54
|
+
*
|
|
55
|
+
* For some reason (that would be great to investigate)
|
|
56
|
+
* urlInfo corresponding to inline content has several referenceFromOthersSet
|
|
57
|
+
* so the latest version is the last reference
|
|
58
|
+
* BUT the last reference is the "http_request"
|
|
59
|
+
* so it's more likely the before last reference that contains the latest version
|
|
60
|
+
*
|
|
61
|
+
* BUT the is an exception when using supervisor as the before last reference
|
|
62
|
+
* is the one fetched by the browser that is already cooked
|
|
63
|
+
* we must re-cook from the original content, not from the already cooked content
|
|
64
|
+
* Otherwise references are already resolved and
|
|
65
|
+
* - "/node_modules/package/file.js" instead of "package/file.js"
|
|
66
|
+
* - meaning we would not create the implicit dependency to package.json
|
|
67
|
+
* - resulting in a reload of the browser (as implicit reference to package.json is gone)
|
|
68
|
+
* -> can create infinite loop of reloads
|
|
69
|
+
*/
|
|
47
70
|
let lastInlineReference;
|
|
48
71
|
let originalContent = urlInfo.originalContent;
|
|
49
72
|
for (const reference of urlInfo.referenceFromOthersSet) {
|
|
50
|
-
if (reference.isInline) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
73
|
+
if (!reference.isInline) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (urlInfo.originalContent === undefined) {
|
|
77
|
+
originalContent = reference.content;
|
|
78
|
+
}
|
|
79
|
+
lastInlineReference = reference;
|
|
80
|
+
if (isDirectRequestToFile) {
|
|
81
|
+
break;
|
|
58
82
|
}
|
|
59
83
|
}
|
|
60
84
|
const { prev } = lastInlineReference;
|
|
@@ -76,12 +100,6 @@ const jsenvPluginInlineContentFetcher = () => {
|
|
|
76
100
|
return {
|
|
77
101
|
originalContent,
|
|
78
102
|
content:
|
|
79
|
-
// we must favor original content to re-apply the same plugin logic
|
|
80
|
-
// so that the same references are generated
|
|
81
|
-
// without this we would try to resolve references like
|
|
82
|
-
// "/node_modules/package/file.js" instead of "package/file.js"
|
|
83
|
-
// meaning we would not create the implicit dependency to package.json
|
|
84
|
-
// resulting in a reload of the browser (as implicit reference to package.json is gone)
|
|
85
103
|
originalContent === undefined
|
|
86
104
|
? lastInlineReference.content
|
|
87
105
|
: originalContent,
|