@jsenv/core 31.1.0 → 31.1.1
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/main.js +19 -1
- package/package.json +1 -2
package/dist/main.js
CHANGED
|
@@ -20,7 +20,6 @@ import { parseHtmlString, stringifyHtmlAst, getHtmlNodeAttribute, visitHtmlNodes
|
|
|
20
20
|
import { createRequire } from "node:module";
|
|
21
21
|
import babelParser from "@babel/parser";
|
|
22
22
|
import { bundleJsModules } from "@jsenv/plugin-bundling";
|
|
23
|
-
import { replacePlaceholders } from "@jsenv/plugin-placeholders";
|
|
24
23
|
import v8, { takeCoverage } from "node:v8";
|
|
25
24
|
import wrapAnsi from "wrap-ansi";
|
|
26
25
|
import stripAnsi from "strip-ansi";
|
|
@@ -17978,6 +17977,25 @@ const babelPluginMetadataImportMetaScenarios = () => {
|
|
|
17978
17977
|
};
|
|
17979
17978
|
};
|
|
17980
17979
|
|
|
17980
|
+
const replacePlaceholders = (urlInfo, replacements) => {
|
|
17981
|
+
const content = urlInfo.content;
|
|
17982
|
+
const magicSource = createMagicSource(content);
|
|
17983
|
+
Object.keys(replacements).forEach(key => {
|
|
17984
|
+
let index = content.indexOf(key);
|
|
17985
|
+
while (index !== -1) {
|
|
17986
|
+
const start = index;
|
|
17987
|
+
const end = index + key.length;
|
|
17988
|
+
magicSource.replace({
|
|
17989
|
+
start,
|
|
17990
|
+
end,
|
|
17991
|
+
replacement: urlInfo.type === "js_classic" || urlInfo.type === "js_module" || urlInfo.type === "html" ? JSON.stringify(replacements[key], null, " ") : replacements[key]
|
|
17992
|
+
});
|
|
17993
|
+
index = content.indexOf(key, end);
|
|
17994
|
+
}
|
|
17995
|
+
});
|
|
17996
|
+
return magicSource.toContentAndSourcemap();
|
|
17997
|
+
};
|
|
17998
|
+
|
|
17981
17999
|
/*
|
|
17982
18000
|
* Source code can contain the following
|
|
17983
18001
|
* - __dev__
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "31.1.
|
|
3
|
+
"version": "31.1.1",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -75,7 +75,6 @@
|
|
|
75
75
|
"@jsenv/log": "3.3.4",
|
|
76
76
|
"@jsenv/node-esm-resolution": "1.0.1",
|
|
77
77
|
"@jsenv/plugin-bundling": "2.0.0",
|
|
78
|
-
"@jsenv/plugin-globals": "1.1.0",
|
|
79
78
|
"@jsenv/server": "15.0.0",
|
|
80
79
|
"@jsenv/sourcemap": "1.0.9",
|
|
81
80
|
"@jsenv/uneval": "1.6.0",
|