@jsenv/core 40.9.1 → 40.10.0
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/build/browserslist_index/browserslist_index.js +407 -20
- package/dist/build/build.js +39 -33
- package/dist/build/jsenv_core_node_modules.js +27 -15
- package/dist/client/directory_listing/jsenv_core_node_modules.js +1 -1
- package/dist/js/import_meta_css_build.js +22 -0
- package/dist/start_build_server/jsenv_core_node_modules.js +19 -11
- package/dist/start_dev_server/jsenv_core_node_modules.js +19 -11
- package/dist/start_dev_server/start_dev_server.js +37 -31
- package/package.json +23 -18
- package/src/build/build.js +2 -2
- package/src/dev/start_dev_server.js +0 -1
- package/src/plugins/import_meta_css/client/import_meta_css_build.js +20 -0
- package/src/plugins/import_meta_css/jsenv_plugin_import_meta_css.js +32 -24
- package/src/plugins/inlining/jsenv_plugin_inlining_into_html.js +2 -2
- package/src/plugins/plugins.js +1 -1
- package/src/plugins/protocol_file/jsenv_plugin_directory_listing.js +0 -2
- package/src/plugins/reference_analysis/html/jsenv_plugin_html_reference_analysis.js +2 -1
- package/src/plugins/resolution_node_esm/jsenv_plugin_node_esm_resolution.js +0 -2
- package/src/plugins/resolution_node_esm/node_esm_resolver.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "40.
|
|
3
|
+
"version": "40.10.0",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -75,17 +75,18 @@
|
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@financial-times/polyfill-useragent-normaliser": "1.10.2",
|
|
78
|
-
"@jsenv/ast": "6.7.
|
|
79
|
-
"@jsenv/js-module-fallback": "1.4.
|
|
80
|
-
"@jsenv/plugin-bundling": "2.
|
|
78
|
+
"@jsenv/ast": "6.7.14",
|
|
79
|
+
"@jsenv/js-module-fallback": "1.4.22",
|
|
80
|
+
"@jsenv/plugin-bundling": "2.10.0",
|
|
81
81
|
"@jsenv/plugin-minification": "1.7.2",
|
|
82
|
-
"@jsenv/plugin-supervisor": "1.7.
|
|
83
|
-
"@jsenv/plugin-transpilation": "1.5.
|
|
84
|
-
"@jsenv/server": "16.3.
|
|
82
|
+
"@jsenv/plugin-supervisor": "1.7.8",
|
|
83
|
+
"@jsenv/plugin-transpilation": "1.5.60",
|
|
84
|
+
"@jsenv/server": "16.3.2",
|
|
85
85
|
"@jsenv/sourcemap": "1.3.10",
|
|
86
86
|
"react-table": "7.8.0"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
+
"@babel/eslint-parser": "7.28.4",
|
|
89
90
|
"@babel/plugin-syntax-decorators": "7.27.1",
|
|
90
91
|
"@babel/plugin-syntax-import-attributes": "7.27.1",
|
|
91
92
|
"@babel/plugin-syntax-optional-chaining-assign": "7.27.1",
|
|
@@ -115,29 +116,33 @@
|
|
|
115
116
|
"@jsenv/url-meta": "workspace:*",
|
|
116
117
|
"@jsenv/urls": "workspace:*",
|
|
117
118
|
"@jsenv/utils": "workspace:*",
|
|
118
|
-
"@playwright/browser-chromium": "1.
|
|
119
|
-
"@playwright/browser-firefox": "1.
|
|
120
|
-
"@playwright/browser-webkit": "1.
|
|
119
|
+
"@playwright/browser-chromium": "1.56.1",
|
|
120
|
+
"@playwright/browser-firefox": "1.56.1",
|
|
121
|
+
"@playwright/browser-webkit": "1.56.1",
|
|
121
122
|
"babel-plugin-transform-async-to-promises": "0.8.18",
|
|
122
|
-
"eslint": "9.
|
|
123
|
+
"eslint": "9.38.0",
|
|
124
|
+
"eslint-plugin-html": "8.1.3",
|
|
125
|
+
"eslint-plugin-import-x": "4.16.1",
|
|
126
|
+
"eslint-plugin-react": "7.37.5",
|
|
127
|
+
"eslint-plugin-regexp": "2.10.0",
|
|
128
|
+
"globals": "16.4.0",
|
|
123
129
|
"open": "10.2.0",
|
|
124
|
-
"playwright": "1.
|
|
125
|
-
"preact": "10.27.
|
|
126
|
-
"preact-iso": "2.9.2",
|
|
130
|
+
"playwright": "1.56.1",
|
|
131
|
+
"preact": "10.27.2",
|
|
127
132
|
"prettier": "3.6.2",
|
|
128
133
|
"prettier-plugin-embed": "0.5.0",
|
|
129
|
-
"prettier-plugin-organize-imports": "4.
|
|
134
|
+
"prettier-plugin-organize-imports": "4.3.0",
|
|
130
135
|
"prettier-plugin-packagejson": "2.5.19",
|
|
131
136
|
"prettier-plugin-sql": "0.19.2",
|
|
132
|
-
"strip-ansi": "7.1.
|
|
137
|
+
"strip-ansi": "7.1.2"
|
|
133
138
|
},
|
|
134
139
|
"packageManager": "npm@11.3.0",
|
|
135
140
|
"engines": {
|
|
136
141
|
"node": ">=20.8.0"
|
|
137
142
|
},
|
|
138
143
|
"volta": {
|
|
139
|
-
"node": "
|
|
140
|
-
"npm": "11.
|
|
144
|
+
"node": "25.0.0",
|
|
145
|
+
"npm": "11.6.2"
|
|
141
146
|
},
|
|
142
147
|
"publishConfig": {
|
|
143
148
|
"access": "public"
|
package/src/build/build.js
CHANGED
|
@@ -337,7 +337,7 @@ export const build = async ({
|
|
|
337
337
|
});
|
|
338
338
|
|
|
339
339
|
const logLevel = logs.level;
|
|
340
|
-
|
|
340
|
+
let logger = createLogger({ logLevel });
|
|
341
341
|
const animatedLogEnabled =
|
|
342
342
|
logs.animated &&
|
|
343
343
|
// canEraseProcessStdout
|
|
@@ -819,9 +819,9 @@ export const build = async ({
|
|
|
819
819
|
const buildTask = createTaskLog("build");
|
|
820
820
|
buildAbortController = new AbortController();
|
|
821
821
|
try {
|
|
822
|
+
logger = createLogger({ logLevel: "warn" });
|
|
822
823
|
const result = await runBuild({
|
|
823
824
|
signal: buildAbortController.signal,
|
|
824
|
-
logLevel: "warn",
|
|
825
825
|
});
|
|
826
826
|
buildTask.done();
|
|
827
827
|
resolveFirstBuild(result);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const installImportMetaCss = (importMeta) => {
|
|
2
|
+
const stylesheet = new CSSStyleSheet({ baseUrl: importMeta.url });
|
|
3
|
+
|
|
4
|
+
let called = false;
|
|
5
|
+
// eslint-disable-next-line accessor-pairs
|
|
6
|
+
Object.defineProperty(importMeta, "css", {
|
|
7
|
+
configurable: true,
|
|
8
|
+
set(value) {
|
|
9
|
+
if (called) {
|
|
10
|
+
throw new Error("import.meta.css setter can only be called once");
|
|
11
|
+
}
|
|
12
|
+
called = true;
|
|
13
|
+
stylesheet.replaceSync(value);
|
|
14
|
+
document.adoptedStyleSheets = [
|
|
15
|
+
...document.adoptedStyleSheets,
|
|
16
|
+
stylesheet,
|
|
17
|
+
];
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
};
|
|
@@ -29,6 +29,9 @@ export const jsenvPluginImportMetaCss = () => {
|
|
|
29
29
|
const importMetaCssClientFileUrl = import.meta.resolve(
|
|
30
30
|
"./client/import_meta_css.js",
|
|
31
31
|
);
|
|
32
|
+
const importMetaCssBuildFileUrl = import.meta.resolve(
|
|
33
|
+
"./client/import_meta_css_build.js",
|
|
34
|
+
);
|
|
32
35
|
|
|
33
36
|
return {
|
|
34
37
|
name: "jsenv:import_meta_css",
|
|
@@ -49,35 +52,17 @@ export const jsenvPluginImportMetaCss = () => {
|
|
|
49
52
|
if (!usesImportMetaCss) {
|
|
50
53
|
return null;
|
|
51
54
|
}
|
|
52
|
-
return injectImportMetaCss(
|
|
55
|
+
return injectImportMetaCss(
|
|
56
|
+
urlInfo,
|
|
57
|
+
urlInfo.context.build
|
|
58
|
+
? importMetaCssBuildFileUrl
|
|
59
|
+
: importMetaCssClientFileUrl,
|
|
60
|
+
);
|
|
53
61
|
},
|
|
54
62
|
},
|
|
55
63
|
};
|
|
56
64
|
};
|
|
57
65
|
|
|
58
|
-
const injectImportMetaCss = (urlInfo, importMetaCssClientFileUrl) => {
|
|
59
|
-
const importMetaCssClientFileReference = urlInfo.dependencies.inject({
|
|
60
|
-
parentUrl: urlInfo.url,
|
|
61
|
-
type: "js_import",
|
|
62
|
-
expectedType: "js_module",
|
|
63
|
-
specifier: importMetaCssClientFileUrl,
|
|
64
|
-
});
|
|
65
|
-
let content = urlInfo.content;
|
|
66
|
-
let prelude = `import { installImportMetaCss } from ${importMetaCssClientFileReference.generatedSpecifier};
|
|
67
|
-
|
|
68
|
-
const remove = installImportMetaCss(import.meta);
|
|
69
|
-
if (import.meta.hot) {
|
|
70
|
-
import.meta.hot.dispose(() => {
|
|
71
|
-
remove();
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
`;
|
|
76
|
-
return {
|
|
77
|
-
content: `${prelude.replace(/\n/g, "")}${content}`,
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
|
|
81
66
|
const babelPluginMetadataUsesImportMetaCss = () => {
|
|
82
67
|
return {
|
|
83
68
|
name: "metadata-uses-import-meta-css",
|
|
@@ -108,3 +93,26 @@ const babelPluginMetadataUsesImportMetaCss = () => {
|
|
|
108
93
|
},
|
|
109
94
|
};
|
|
110
95
|
};
|
|
96
|
+
|
|
97
|
+
const injectImportMetaCss = (urlInfo, importMetaCssClientFileUrl) => {
|
|
98
|
+
const importMetaCssClientFileReference = urlInfo.dependencies.inject({
|
|
99
|
+
parentUrl: urlInfo.url,
|
|
100
|
+
type: "js_import",
|
|
101
|
+
expectedType: "js_module",
|
|
102
|
+
specifier: importMetaCssClientFileUrl,
|
|
103
|
+
});
|
|
104
|
+
let content = urlInfo.content;
|
|
105
|
+
let prelude = `import { installImportMetaCss } from ${importMetaCssClientFileReference.generatedSpecifier};
|
|
106
|
+
|
|
107
|
+
const remove = installImportMetaCss(import.meta);
|
|
108
|
+
if (import.meta.hot) {
|
|
109
|
+
import.meta.hot.dispose(() => {
|
|
110
|
+
remove();
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
`;
|
|
115
|
+
return {
|
|
116
|
+
content: `${prelude.replace(/\n/g, "")}${content}`,
|
|
117
|
+
};
|
|
118
|
+
};
|
|
@@ -78,7 +78,7 @@ export const jsenvPluginInliningIntoHtml = () => {
|
|
|
78
78
|
});
|
|
79
79
|
});
|
|
80
80
|
};
|
|
81
|
-
const onScriptWithSrc = (scriptNode, { src }) => {
|
|
81
|
+
const onScriptWithSrc = (scriptNode, { type, src }) => {
|
|
82
82
|
let scriptReference;
|
|
83
83
|
for (const dependencyReference of urlInfo.referenceToOthersSet) {
|
|
84
84
|
if (
|
|
@@ -105,7 +105,7 @@ export const jsenvPluginInliningIntoHtml = () => {
|
|
|
105
105
|
column,
|
|
106
106
|
isOriginal,
|
|
107
107
|
specifier: scriptInlineUrl,
|
|
108
|
-
type
|
|
108
|
+
type,
|
|
109
109
|
subtype: scriptReference.subtype,
|
|
110
110
|
expectedType: scriptReference.expectedType,
|
|
111
111
|
});
|
package/src/plugins/plugins.js
CHANGED
|
@@ -151,7 +151,7 @@ export const getCorePlugins = ({
|
|
|
151
151
|
jsenvPluginCleanHTML(),
|
|
152
152
|
jsenvPluginChromeDevtoolsJson(),
|
|
153
153
|
...(packageSideEffects
|
|
154
|
-
? [jsenvPluginPackageSideEffects({
|
|
154
|
+
? [jsenvPluginPackageSideEffects({ packageDirectory })]
|
|
155
155
|
: []),
|
|
156
156
|
];
|
|
157
157
|
};
|
|
@@ -174,7 +174,6 @@ export const jsenvPluginDirectoryListing = ({
|
|
|
174
174
|
const items = getDirectoryContentItems({
|
|
175
175
|
serverRootDirectoryUrl: rootDirectoryUrl,
|
|
176
176
|
mainFilePath,
|
|
177
|
-
requestedUrl,
|
|
178
177
|
firstExistingDirectoryUrl,
|
|
179
178
|
});
|
|
180
179
|
return items;
|
|
@@ -242,7 +241,6 @@ const generateDirectoryListingInjection = (
|
|
|
242
241
|
const directoryContentItems = getDirectoryContentItems({
|
|
243
242
|
serverRootDirectoryUrl,
|
|
244
243
|
mainFilePath,
|
|
245
|
-
requestedUrl: urlNotFound,
|
|
246
244
|
firstExistingDirectoryUrl,
|
|
247
245
|
});
|
|
248
246
|
package_workspaces: {
|
|
@@ -252,7 +252,7 @@ export const jsenvPluginHtmlReferenceAnalysis = ({
|
|
|
252
252
|
const createInlineReference = (
|
|
253
253
|
node,
|
|
254
254
|
inlineContent,
|
|
255
|
-
{ type, expectedType, contentType },
|
|
255
|
+
{ type, subtype, expectedType, contentType },
|
|
256
256
|
) => {
|
|
257
257
|
const hotAccept =
|
|
258
258
|
getHtmlNodeAttribute(node, "hot-accept") !== undefined;
|
|
@@ -268,6 +268,7 @@ export const jsenvPluginHtmlReferenceAnalysis = ({
|
|
|
268
268
|
getHtmlNodeAttribute(node, "jsenv-debug") !== undefined;
|
|
269
269
|
const inlineReference = urlInfo.dependencies.foundInline({
|
|
270
270
|
type,
|
|
271
|
+
subtype,
|
|
271
272
|
expectedType,
|
|
272
273
|
isOriginalPosition: isOriginal,
|
|
273
274
|
specifierLine: line,
|
|
@@ -22,7 +22,6 @@ export const jsenvPluginNodeEsmResolution = (
|
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
24
|
return createNodeEsmResolver({
|
|
25
|
-
build: kitchenContext.build,
|
|
26
25
|
runtimeCompat: kitchenContext.runtimeCompat,
|
|
27
26
|
rootDirectoryUrl: kitchenContext.rootDirectoryUrl,
|
|
28
27
|
packageConditions,
|
|
@@ -39,7 +38,6 @@ export const jsenvPluginNodeEsmResolution = (
|
|
|
39
38
|
appliesDuring: "*",
|
|
40
39
|
init: (kitchenContext) => {
|
|
41
40
|
nodeEsmResolverDefault = createNodeEsmResolver({
|
|
42
|
-
build: kitchenContext.build,
|
|
43
41
|
runtimeCompat: kitchenContext.runtimeCompat,
|
|
44
42
|
rootDirectoryUrl: kitchenContext.rootDirectoryUrl,
|
|
45
43
|
preservesSymlink: true,
|