@jsenv/core 40.9.1 → 40.11.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 +426 -20
- package/dist/build/build.js +135 -65
- 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 → client/import_meta_css}/import_meta_css.js +15 -11
- package/dist/client/import_meta_css/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 +57 -35
- package/package.json +24 -18
- package/src/build/build.js +78 -30
- package/src/dev/start_dev_server.js +0 -1
- package/src/kitchen/errors.js +5 -0
- package/src/kitchen/kitchen.js +6 -2
- 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/protocol_file/jsenv_plugin_protocol_file.js +7 -0
- 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/dist/{js → client/drop_to_open}/drop_to_open.js +0 -0
|
@@ -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: {
|
|
@@ -95,6 +95,10 @@ export const jsenvPluginProtocolFile = ({
|
|
|
95
95
|
return null;
|
|
96
96
|
}
|
|
97
97
|
const { firstReference } = urlInfo;
|
|
98
|
+
if (!firstReference) {
|
|
99
|
+
console.warn("No firstReference for", urlInfo.url);
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
98
102
|
let { fsStat } = firstReference;
|
|
99
103
|
if (!fsStat) {
|
|
100
104
|
fsStat = readEntryStatSync(urlInfo.url, { nullIfNotFound: true });
|
|
@@ -123,6 +127,9 @@ export const jsenvPluginProtocolFile = ({
|
|
|
123
127
|
return null;
|
|
124
128
|
}
|
|
125
129
|
const { firstReference } = urlInfo;
|
|
130
|
+
if (!firstReference) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
126
133
|
let { fsStat } = firstReference;
|
|
127
134
|
if (!fsStat) {
|
|
128
135
|
fsStat = readEntryStatSync(urlInfo.url, { nullIfNotFound: true });
|
|
@@ -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,
|
|
File without changes
|