@jsenv/core 27.0.0-alpha.67 → 27.0.0-alpha.68
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 +33 -31
- package/package.json +6 -5
- package/src/build/build.js +10 -10
- package/src/build/build_urls_generator.js +1 -1
- package/src/build/start_build_server.js +1 -1
- package/src/dev/plugins/explorer/jsenv_plugin_explorer.js +5 -9
- package/src/dev/start_dev_server.js +1 -1
- package/src/execute/run.js +2 -1
- package/src/execute/runtimes/browsers/from_playwright.js +1 -1
- package/src/execute/runtimes/node/node_process.js +1 -1
- package/src/omega/file_url_converter.js +1 -1
- package/src/omega/kitchen.js +6 -6
- package/src/omega/server/file_service.js +1 -1
- package/src/omega/url_graph/url_info_transformations.js +2 -1
- package/src/omega/url_graph.js +1 -1
- package/src/plugins/autoreload/dev_sse/jsenv_plugin_dev_sse_server.js +1 -1
- package/src/plugins/bundling/js_module/bundle_js_module.js +4 -13
- package/src/plugins/file_urls/jsenv_plugin_file_urls.js +2 -2
- package/src/plugins/html_supervisor/jsenv_plugin_html_supervisor.js +1 -1
- package/src/plugins/importmap/jsenv_plugin_importmap.js +1 -1
- package/src/plugins/inline/jsenv_plugin_data_urls.js +1 -1
- package/src/plugins/inline/jsenv_plugin_html_inline_content.js +1 -1
- package/src/plugins/inline/jsenv_plugin_inline_query_param.js +1 -1
- package/src/plugins/inline/jsenv_plugin_js_inline_content.js +1 -1
- package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic.js +2 -2
- package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic_html.js +4 -2
- package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic_workers.js +1 -1
- package/src/plugins/transpilation/import_assertions/jsenv_plugin_import_assertions.js +1 -2
- package/src/plugins/url_analysis/jsenv_plugin_url_analysis.js +5 -14
- package/src/test/execute_plan.js +10 -13
- package/src/test/execute_test_plan.js +10 -16
- package/src/test/execution_steps.js +1 -4
package/dist/main.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { parentPort } from "node:worker_threads";
|
|
2
|
-
import {
|
|
2
|
+
import { registerFileLifecycle, readFileSync as readFileSync$1, bufferToEtag, writeFileSync, ensureWindowsDriveLetter, collectFiles, assertAndNormalizeDirectoryUrl, registerDirectoryLifecycle, writeFile, ensureEmptyDirectory, writeDirectory } from "@jsenv/filesystem";
|
|
3
3
|
import { createDetailedMessage, createLogger, loggerToLevels } from "@jsenv/logger";
|
|
4
4
|
import { createTaskLog, ANSI, msAsDuration, msAsEllapsedTime, byteAsMemoryUsage, UNICODE, createLog, startSpinner, distributePercentages, byteAsFileSize } from "@jsenv/log";
|
|
5
|
-
import { getCallerPosition } from "@jsenv/
|
|
5
|
+
import { urlToRelativeUrl, URL_META, generateInlineContentUrl, ensurePathnameTrailingSlash, urlIsInsideOf, urlToFilename, urlToExtension, DataUrl, injectQueryParams, injectQueryParamsIntoSpecifier, fileSystemPathToUrl, urlToFileSystemPath, isFileSystemPath, normalizeUrl, stringifyUrlSite, setUrlFilename, moveUrl, getCallerPosition, resolveUrl, resolveDirectoryUrl, asUrlWithoutSearch, asUrlUntilPathname, urlToBasename } from "@jsenv/urls";
|
|
6
6
|
import { initReloadableProcess } from "@jsenv/utils/process_reload/process_reload.js";
|
|
7
7
|
import { parseHtmlString, stringifyHtmlAst, visitHtmlAst, getHtmlNodeAttributeByName, htmlNodePosition, findNode, getHtmlNodeTextNode, removeHtmlNode, setHtmlNodeGeneratedText, removeHtmlNodeAttributeByName, parseScriptNode, injectScriptAsEarlyAsPossible, createHtmlNode, removeHtmlNodeText, assignHtmlNodeAttributes, parseLinkNode } from "@jsenv/utils/html_ast/html_ast.js";
|
|
8
8
|
import { htmlAttributeSrcSet } from "@jsenv/utils/html_ast/html_attribute_src_set.js";
|
|
@@ -11,15 +11,12 @@ import { applyPostCss } from "@jsenv/utils/css_ast/apply_post_css.js";
|
|
|
11
11
|
import { postCssPluginUrlVisitor } from "@jsenv/utils/css_ast/postcss_plugin_url_visitor.js";
|
|
12
12
|
import { parseJsUrls } from "@jsenv/utils/js_ast/parse_js_urls.js";
|
|
13
13
|
import { resolveImport, normalizeImportMap, composeTwoImportMaps } from "@jsenv/importmap";
|
|
14
|
-
import { generateInlineContentUrl } from "@jsenv/utils/urls/inline_content_url_generator.js";
|
|
15
14
|
import { applyNodeEsmResolution, defaultLookupPackageScope, defaultReadPackageJson, readCustomConditionsFromProcessArgs, applyFileSystemMagicResolution } from "@jsenv/node-esm-resolution";
|
|
16
15
|
import { statSync, realpathSync, readdirSync, readFileSync, existsSync } from "node:fs";
|
|
17
16
|
import { pathToFileURL } from "node:url";
|
|
18
|
-
import { ensurePathnameTrailingSlash, injectQueryParams, injectQueryParamsIntoSpecifier, normalizeUrl, setUrlFilename, asUrlWithoutSearch, asUrlUntilPathname } from "@jsenv/utils/urls/url_utils.js";
|
|
19
17
|
import { CONTENT_TYPE } from "@jsenv/utils/content_type/content_type.js";
|
|
20
18
|
import { JS_QUOTES } from "@jsenv/utils/string/js_quotes.js";
|
|
21
19
|
import { applyBabelPlugins } from "@jsenv/utils/js_ast/apply_babel_plugins.js";
|
|
22
|
-
import { DataUrl } from "@jsenv/utils/urls/data_url.js";
|
|
23
20
|
import { transpileWithParcel, minifyWithParcel } from "@jsenv/utils/css_ast/parcel_css.js";
|
|
24
21
|
import { createRequire } from "node:module";
|
|
25
22
|
import { composeTwoSourcemaps } from "@jsenv/utils/sourcemap/sourcemap_composition_v3.js";
|
|
@@ -31,7 +28,6 @@ import { applyRollupPlugins } from "@jsenv/utils/js_ast/apply_rollup_plugins.js"
|
|
|
31
28
|
import { sourcemapConverter } from "@jsenv/utils/sourcemap/sourcemap_converter.js";
|
|
32
29
|
import { createCallbackList, createCallbackListNotifiedOnce, Abort, raceCallbacks, raceProcessTeardownEvents } from "@jsenv/abort";
|
|
33
30
|
import { createSSEService } from "@jsenv/utils/event_source/sse_service.js";
|
|
34
|
-
import { stringifyUrlSite } from "@jsenv/utils/urls/url_trace.js";
|
|
35
31
|
import { timeStart, fetchFileSystem, composeTwoResponses, serveDirectory, startServer, pluginCORS, jsenvAccessControlAllowedHeaders, pluginServerTiming, pluginRequestWaitingCheck, composeServices, findFreePort } from "@jsenv/server";
|
|
36
32
|
import { SOURCEMAP, generateSourcemapUrl, sourcemapToBase64Url } from "@jsenv/utils/sourcemap/sourcemap_utils.js";
|
|
37
33
|
import { validateResponseIntegrity } from "@jsenv/integrity";
|
|
@@ -512,16 +508,18 @@ const jsenvPluginUrlAnalysis = ({
|
|
|
512
508
|
let getIncludeInfo = () => undefined;
|
|
513
509
|
|
|
514
510
|
if (include) {
|
|
515
|
-
const
|
|
511
|
+
const associations = URL_META.resolveAssociations({
|
|
516
512
|
include
|
|
517
513
|
}, rootDirectoryUrl);
|
|
518
514
|
|
|
519
515
|
getIncludeInfo = url => {
|
|
520
|
-
const
|
|
516
|
+
const {
|
|
517
|
+
include
|
|
518
|
+
} = URL_META.applyAssociations({
|
|
521
519
|
url,
|
|
522
|
-
|
|
520
|
+
associations
|
|
523
521
|
});
|
|
524
|
-
return
|
|
522
|
+
return include;
|
|
525
523
|
};
|
|
526
524
|
}
|
|
527
525
|
|
|
@@ -4858,14 +4856,14 @@ const rollupPluginJsenv = ({
|
|
|
4858
4856
|
let importCanBeBundled = () => true;
|
|
4859
4857
|
|
|
4860
4858
|
if (include) {
|
|
4861
|
-
const
|
|
4859
|
+
const associations = URL_META.resolveAssociations({
|
|
4862
4860
|
bundle: include
|
|
4863
4861
|
}, rootDirectoryUrl);
|
|
4864
4862
|
|
|
4865
4863
|
importCanBeBundled = url => {
|
|
4866
|
-
return
|
|
4864
|
+
return URL_META.applyAssociations({
|
|
4867
4865
|
url,
|
|
4868
|
-
|
|
4866
|
+
associations
|
|
4869
4867
|
}).bundle;
|
|
4870
4868
|
};
|
|
4871
4869
|
}
|
|
@@ -8336,19 +8334,18 @@ const jsenvPluginExplorer = ({
|
|
|
8336
8334
|
return null;
|
|
8337
8335
|
}
|
|
8338
8336
|
|
|
8339
|
-
const
|
|
8337
|
+
const associationsForExplorable = {};
|
|
8340
8338
|
Object.keys(groups).forEach(groupName => {
|
|
8341
8339
|
const groupConfig = groups[groupName];
|
|
8342
|
-
|
|
8340
|
+
associationsForExplorable[groupName] = {
|
|
8343
8341
|
"**/.jsenv/": false,
|
|
8344
8342
|
// avoid visting .jsenv directory in jsenv itself
|
|
8345
8343
|
...groupConfig
|
|
8346
8344
|
};
|
|
8347
8345
|
});
|
|
8348
|
-
const structuredMetaMapForExplorable = normalizeStructuredMetaMap(structuredMetaMapRelativeForExplorable, rootDirectoryUrl);
|
|
8349
8346
|
const matchingFileResultArray = await collectFiles({
|
|
8350
8347
|
directoryUrl: rootDirectoryUrl,
|
|
8351
|
-
|
|
8348
|
+
associations: associationsForExplorable,
|
|
8352
8349
|
predicate: meta => Object.keys(meta).some(group => Boolean(meta[group]))
|
|
8353
8350
|
});
|
|
8354
8351
|
const files = matchingFileResultArray.map(({
|
|
@@ -8825,13 +8822,12 @@ const generateExecutionSteps = async (plan, {
|
|
|
8825
8822
|
signal,
|
|
8826
8823
|
rootDirectoryUrl
|
|
8827
8824
|
}) => {
|
|
8828
|
-
const structuredMetaMap = {
|
|
8829
|
-
filePlan: plan
|
|
8830
|
-
};
|
|
8831
8825
|
const fileResultArray = await collectFiles({
|
|
8832
8826
|
signal,
|
|
8833
8827
|
directoryUrl: rootDirectoryUrl,
|
|
8834
|
-
|
|
8828
|
+
associations: {
|
|
8829
|
+
filePlan: plan
|
|
8830
|
+
},
|
|
8835
8831
|
predicate: ({
|
|
8836
8832
|
filePlan
|
|
8837
8833
|
}) => filePlan
|
|
@@ -9306,15 +9302,18 @@ const executePlan = async (plan, {
|
|
|
9306
9302
|
const coverageTempDirectoryUrl = new URL(coverageTempDirectoryRelativeUrl, rootDirectoryUrl).href;
|
|
9307
9303
|
|
|
9308
9304
|
if (coverage) {
|
|
9309
|
-
const
|
|
9305
|
+
const associations = URL_META.resolveAssociations({
|
|
9310
9306
|
cover: coverageConfig
|
|
9311
9307
|
}, rootDirectoryUrl);
|
|
9312
9308
|
|
|
9313
9309
|
const urlShouldBeCovered = url => {
|
|
9314
|
-
|
|
9310
|
+
const {
|
|
9311
|
+
cover
|
|
9312
|
+
} = URL_META.applyAssociations({
|
|
9315
9313
|
url: new URL(url, rootDirectoryUrl).href,
|
|
9316
|
-
|
|
9317
|
-
})
|
|
9314
|
+
associations
|
|
9315
|
+
});
|
|
9316
|
+
return cover;
|
|
9318
9317
|
};
|
|
9319
9318
|
|
|
9320
9319
|
runtimeParams.urlShouldBeCovered = urlShouldBeCovered; // in case runned multiple times, we don't want to keep writing lot of files in this directory
|
|
@@ -9777,17 +9776,20 @@ const executeTestPlan = async ({
|
|
|
9777
9776
|
}
|
|
9778
9777
|
|
|
9779
9778
|
if (!coverageAndExecutionAllowed) {
|
|
9780
|
-
const
|
|
9779
|
+
const associationsForExecute = URL_META.resolveAssociations({
|
|
9781
9780
|
execute: testPlan
|
|
9782
9781
|
}, "file:///");
|
|
9783
|
-
const
|
|
9782
|
+
const associationsForCover = URL_META.resolveAssociations({
|
|
9784
9783
|
cover: coverageConfig
|
|
9785
9784
|
}, "file:///");
|
|
9786
|
-
const patternsMatchingCoverAndExecute = Object.keys(
|
|
9787
|
-
|
|
9785
|
+
const patternsMatchingCoverAndExecute = Object.keys(associationsForExecute.execute).filter(testPlanPattern => {
|
|
9786
|
+
const {
|
|
9787
|
+
cover
|
|
9788
|
+
} = URL_META.applyAssociations({
|
|
9788
9789
|
url: testPlanPattern,
|
|
9789
|
-
|
|
9790
|
-
})
|
|
9790
|
+
associations: associationsForCover
|
|
9791
|
+
});
|
|
9792
|
+
return cover;
|
|
9791
9793
|
});
|
|
9792
9794
|
|
|
9793
9795
|
if (patternsMatchingCoverAndExecute.length) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "27.0.0-alpha.
|
|
3
|
+
"version": "27.0.0-alpha.68",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"dev": "node --conditions=development ./scripts/dev/dev.mjs",
|
|
46
46
|
"build": "node --conditions=development ./scripts/build/build.mjs",
|
|
47
47
|
"test": "node --conditions=development ./scripts/test/test.mjs",
|
|
48
|
-
"test-packages": "npm run test --workspaces --if-present",
|
|
48
|
+
"test-packages": "npm run test --workspaces --if-present -- --workspace",
|
|
49
49
|
"start_file_server": "node ./scripts/dev/start_file_server.mjs",
|
|
50
50
|
"workspace-versions": "node ./scripts/publish/workspace_versions.mjs",
|
|
51
51
|
"workspace-publish": "node ./scripts/publish/workspace_publish.mjs",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@financial-times/polyfill-useragent-normaliser": "2.0.1",
|
|
70
70
|
"@jsenv/abort": "4.1.2",
|
|
71
71
|
"@jsenv/babel-plugins": "1.0.2",
|
|
72
|
-
"@jsenv/filesystem": "
|
|
72
|
+
"@jsenv/filesystem": "4.0.1",
|
|
73
73
|
"@jsenv/importmap": "1.2.0",
|
|
74
74
|
"@jsenv/integrity": "0.0.1",
|
|
75
75
|
"@jsenv/log": "1.6.3",
|
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
"@jsenv/node-esm-resolution": "0.0.10",
|
|
78
78
|
"@jsenv/server": "12.6.3",
|
|
79
79
|
"@jsenv/uneval": "1.6.0",
|
|
80
|
-
"@jsenv/utils": "1.8.
|
|
80
|
+
"@jsenv/utils": "1.8.4",
|
|
81
|
+
"@jsenv/urls": "1.1.1",
|
|
81
82
|
"construct-style-sheets-polyfill": "3.1.0",
|
|
82
83
|
"cssnano": "5.1.7",
|
|
83
84
|
"cssnano-preset-default": "5.2.7",
|
|
@@ -104,7 +105,7 @@
|
|
|
104
105
|
"@jsenv/file-size-impact": "12.1.13",
|
|
105
106
|
"@jsenv/https-local": "1.0.11",
|
|
106
107
|
"@jsenv/importmap-node-module": "5.1.3",
|
|
107
|
-
"@jsenv/package-workspace": "0.2.
|
|
108
|
+
"@jsenv/package-workspace": "0.2.1",
|
|
108
109
|
"@jsenv/performance-impact": "2.2.11",
|
|
109
110
|
"@jsenv/pwa": "5.0.0",
|
|
110
111
|
"eslint": "8.13.0",
|
package/src/build/build.js
CHANGED
|
@@ -7,12 +7,20 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
injectQueryParams,
|
|
11
|
+
setUrlFilename,
|
|
12
|
+
asUrlUntilPathname,
|
|
13
|
+
normalizeUrl,
|
|
14
|
+
asUrlWithoutSearch,
|
|
15
|
+
ensurePathnameTrailingSlash,
|
|
12
16
|
urlIsInsideOf,
|
|
13
17
|
urlToBasename,
|
|
14
18
|
urlToExtension,
|
|
15
19
|
urlToRelativeUrl,
|
|
20
|
+
} from "@jsenv/urls"
|
|
21
|
+
import {
|
|
22
|
+
assertAndNormalizeDirectoryUrl,
|
|
23
|
+
ensureEmptyDirectory,
|
|
16
24
|
writeFile,
|
|
17
25
|
registerDirectoryLifecycle,
|
|
18
26
|
} from "@jsenv/filesystem"
|
|
@@ -20,14 +28,6 @@ import { Abort, raceProcessTeardownEvents } from "@jsenv/abort"
|
|
|
20
28
|
import { createLogger, loggerToLevels } from "@jsenv/logger"
|
|
21
29
|
|
|
22
30
|
import { createTaskLog } from "@jsenv/log"
|
|
23
|
-
import {
|
|
24
|
-
injectQueryParams,
|
|
25
|
-
setUrlFilename,
|
|
26
|
-
asUrlUntilPathname,
|
|
27
|
-
normalizeUrl,
|
|
28
|
-
asUrlWithoutSearch,
|
|
29
|
-
ensurePathnameTrailingSlash,
|
|
30
|
-
} from "@jsenv/utils/urls/url_utils.js"
|
|
31
31
|
import { createVersionGenerator } from "@jsenv/utils/versioning/version_generator.js"
|
|
32
32
|
import { generateSourcemapUrl } from "@jsenv/utils/sourcemap/sourcemap_utils.js"
|
|
33
33
|
import {
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
import { createLogger, loggerToLevels } from "@jsenv/logger"
|
|
31
31
|
|
|
32
32
|
import { createTaskLog } from "@jsenv/log"
|
|
33
|
-
import { getCallerPosition } from "@jsenv/
|
|
33
|
+
import { getCallerPosition } from "@jsenv/urls"
|
|
34
34
|
import { initReloadableProcess } from "@jsenv/utils/process_reload/process_reload.js"
|
|
35
35
|
|
|
36
36
|
export const startBuildServer = async ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs"
|
|
2
|
-
import {
|
|
2
|
+
import { DataUrl } from "@jsenv/urls"
|
|
3
|
+
import { collectFiles } from "@jsenv/filesystem"
|
|
3
4
|
|
|
4
|
-
import { DataUrl } from "@jsenv/utils/urls/data_url.js"
|
|
5
5
|
import { CONTENT_TYPE } from "@jsenv/utils/content_type/content_type.js"
|
|
6
6
|
|
|
7
7
|
export const jsenvPluginExplorer = ({ groups }) => {
|
|
@@ -17,21 +17,17 @@ export const jsenvPluginExplorer = ({ groups }) => {
|
|
|
17
17
|
if (request.ressource !== "/") {
|
|
18
18
|
return null
|
|
19
19
|
}
|
|
20
|
-
const
|
|
20
|
+
const associationsForExplorable = {}
|
|
21
21
|
Object.keys(groups).forEach((groupName) => {
|
|
22
22
|
const groupConfig = groups[groupName]
|
|
23
|
-
|
|
23
|
+
associationsForExplorable[groupName] = {
|
|
24
24
|
"**/.jsenv/": false, // avoid visting .jsenv directory in jsenv itself
|
|
25
25
|
...groupConfig,
|
|
26
26
|
}
|
|
27
27
|
})
|
|
28
|
-
const structuredMetaMapForExplorable = normalizeStructuredMetaMap(
|
|
29
|
-
structuredMetaMapRelativeForExplorable,
|
|
30
|
-
rootDirectoryUrl,
|
|
31
|
-
)
|
|
32
28
|
const matchingFileResultArray = await collectFiles({
|
|
33
29
|
directoryUrl: rootDirectoryUrl,
|
|
34
|
-
|
|
30
|
+
associations: associationsForExplorable,
|
|
35
31
|
predicate: (meta) =>
|
|
36
32
|
Object.keys(meta).some((group) => Boolean(meta[group])),
|
|
37
33
|
})
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
import { createLogger, loggerToLevels } from "@jsenv/logger"
|
|
7
7
|
|
|
8
8
|
import { createTaskLog } from "@jsenv/log"
|
|
9
|
-
import { getCallerPosition } from "@jsenv/
|
|
9
|
+
import { getCallerPosition } from "@jsenv/urls"
|
|
10
10
|
import { initReloadableProcess } from "@jsenv/utils/process_reload/process_reload.js"
|
|
11
11
|
import { getCorePlugins } from "@jsenv/core/src/plugins/plugins.js"
|
|
12
12
|
import { createUrlGraph } from "@jsenv/core/src/omega/url_graph.js"
|
package/src/execute/run.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import cuid from "cuid"
|
|
2
2
|
import { Abort, raceCallbacks } from "@jsenv/abort"
|
|
3
|
-
import { resolveUrl
|
|
3
|
+
import { resolveUrl } from "@jsenv/urls"
|
|
4
|
+
import { writeFile } from "@jsenv/filesystem"
|
|
4
5
|
|
|
5
6
|
export const run = async ({
|
|
6
7
|
signal = new AbortController().signal,
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
raceProcessTeardownEvents,
|
|
7
7
|
raceCallbacks,
|
|
8
8
|
} from "@jsenv/abort"
|
|
9
|
-
import { moveUrl } from "@jsenv/
|
|
9
|
+
import { moveUrl } from "@jsenv/urls"
|
|
10
10
|
|
|
11
11
|
import { memoize } from "@jsenv/utils/memoize/memoize.js"
|
|
12
12
|
import { filterV8Coverage } from "@jsenv/utils/coverage/v8_coverage_from_directory.js"
|
package/src/omega/kitchen.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
urlIsInsideOf,
|
|
3
|
-
writeFileSync,
|
|
4
3
|
moveUrl,
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
getCallerPosition,
|
|
5
|
+
stringifyUrlSite,
|
|
6
|
+
normalizeUrl,
|
|
7
|
+
setUrlFilename,
|
|
8
|
+
} from "@jsenv/urls"
|
|
9
|
+
import { writeFileSync, ensureWindowsDriveLetter } from "@jsenv/filesystem"
|
|
7
10
|
import { createDetailedMessage } from "@jsenv/logger"
|
|
8
11
|
|
|
9
|
-
import { getCallerPosition } from "@jsenv/utils/src/caller_position.js"
|
|
10
|
-
import { stringifyUrlSite } from "@jsenv/utils/urls/url_trace.js"
|
|
11
12
|
import { CONTENT_TYPE } from "@jsenv/utils/content_type/content_type.js"
|
|
12
|
-
import { normalizeUrl, setUrlFilename } from "@jsenv/utils/urls/url_utils.js"
|
|
13
13
|
|
|
14
14
|
import { createPluginController } from "../plugins/plugin_controller.js"
|
|
15
15
|
import { urlSpecifierEncoding } from "./url_specifier_encoding.js"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { bufferToEtag
|
|
1
|
+
import { bufferToEtag } from "@jsenv/filesystem"
|
|
2
|
+
import { urlToRelativeUrl } from "@jsenv/urls"
|
|
2
3
|
|
|
3
4
|
import { composeTwoSourcemaps } from "@jsenv/utils/sourcemap/sourcemap_composition_v3.js"
|
|
4
5
|
import {
|
package/src/omega/url_graph.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { pathToFileURL } from "node:url"
|
|
2
|
-
import {
|
|
3
|
-
isFileSystemPath,
|
|
4
|
-
normalizeStructuredMetaMap,
|
|
5
|
-
urlToMeta,
|
|
6
|
-
} from "@jsenv/filesystem"
|
|
2
|
+
import { isFileSystemPath, URL_META } from "@jsenv/urls"
|
|
7
3
|
import { createDetailedMessage } from "@jsenv/logger"
|
|
8
4
|
|
|
9
5
|
import { babelHelperNameFromUrl } from "@jsenv/babel-plugins"
|
|
@@ -145,17 +141,12 @@ const rollupPluginJsenv = ({
|
|
|
145
141
|
}
|
|
146
142
|
let importCanBeBundled = () => true
|
|
147
143
|
if (include) {
|
|
148
|
-
const
|
|
149
|
-
{
|
|
150
|
-
bundle: include,
|
|
151
|
-
},
|
|
144
|
+
const associations = URL_META.resolveAssociations(
|
|
145
|
+
{ bundle: include },
|
|
152
146
|
rootDirectoryUrl,
|
|
153
147
|
)
|
|
154
148
|
importCanBeBundled = (url) => {
|
|
155
|
-
return
|
|
156
|
-
url,
|
|
157
|
-
structuredMetaMap: bundleIncludeConfig,
|
|
158
|
-
}).bundle
|
|
149
|
+
return URL_META.applyAssociations({ url, associations }).bundle
|
|
159
150
|
}
|
|
160
151
|
}
|
|
161
152
|
const urlImporters = {}
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
urlToRelativeUrl,
|
|
6
6
|
urlToExtension,
|
|
7
7
|
urlToFilename,
|
|
8
|
-
|
|
8
|
+
ensurePathnameTrailingSlash,
|
|
9
|
+
} from "@jsenv/urls"
|
|
9
10
|
|
|
10
11
|
import { applyFileSystemMagicResolution } from "@jsenv/node-esm-resolution"
|
|
11
|
-
import { ensurePathnameTrailingSlash } from "@jsenv/utils/urls/url_utils.js"
|
|
12
12
|
import { CONTENT_TYPE } from "@jsenv/utils/content_type/content_type.js"
|
|
13
13
|
|
|
14
14
|
export const jsenvPluginFileUrls = ({
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
removeHtmlNodeText,
|
|
19
19
|
setHtmlNodeGeneratedText,
|
|
20
20
|
} from "@jsenv/utils/html_ast/html_ast.js"
|
|
21
|
-
import { generateInlineContentUrl } from "@jsenv/
|
|
21
|
+
import { generateInlineContentUrl } from "@jsenv/urls"
|
|
22
22
|
|
|
23
23
|
export const jsenvPluginHtmlSupervisor = ({
|
|
24
24
|
logs = false,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
getHtmlNodeTextNode,
|
|
35
35
|
removeHtmlNode,
|
|
36
36
|
} from "@jsenv/utils/html_ast/html_ast.js"
|
|
37
|
-
import { generateInlineContentUrl } from "@jsenv/
|
|
37
|
+
import { generateInlineContentUrl } from "@jsenv/urls"
|
|
38
38
|
|
|
39
39
|
export const jsenvPluginImportmap = () => {
|
|
40
40
|
let finalImportmap = null
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
setHtmlNodeGeneratedText,
|
|
9
9
|
getHtmlNodeAttributeByName,
|
|
10
10
|
} from "@jsenv/utils/html_ast/html_ast.js"
|
|
11
|
-
import { generateInlineContentUrl } from "@jsenv/
|
|
11
|
+
import { generateInlineContentUrl } from "@jsenv/urls"
|
|
12
12
|
import { CONTENT_TYPE } from "@jsenv/utils/content_type/content_type.js"
|
|
13
13
|
|
|
14
14
|
export const jsenvPluginHtmlInlineContent = ({ analyzeConvertedScripts }) => {
|
|
@@ -2,7 +2,7 @@ import { CONTENT_TYPE } from "@jsenv/utils/content_type/content_type.js"
|
|
|
2
2
|
import { createMagicSource } from "@jsenv/utils/sourcemap/magic_source.js"
|
|
3
3
|
import { JS_QUOTES } from "@jsenv/utils/string/js_quotes.js"
|
|
4
4
|
import { applyBabelPlugins } from "@jsenv/utils/js_ast/apply_babel_plugins.js"
|
|
5
|
-
import { generateInlineContentUrl } from "@jsenv/
|
|
5
|
+
import { generateInlineContentUrl } from "@jsenv/urls"
|
|
6
6
|
|
|
7
7
|
export const jsenvPluginJsInlineContent = ({ allowEscapeForVersioning }) => {
|
|
8
8
|
const parseAndTransformInlineContentCalls = async (urlInfo, context) => {
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import { createRequire } from "node:module"
|
|
15
|
-
import {
|
|
15
|
+
import { urlToFilename, injectQueryParams } from "@jsenv/urls"
|
|
16
|
+
import { readFileSync } from "@jsenv/filesystem"
|
|
16
17
|
|
|
17
18
|
import { requireBabelPlugin } from "@jsenv/babel-plugins"
|
|
18
19
|
import { applyBabelPlugins } from "@jsenv/utils/js_ast/apply_babel_plugins.js"
|
|
19
|
-
import { injectQueryParams } from "@jsenv/utils/urls/url_utils.js"
|
|
20
20
|
import { createMagicSource } from "@jsenv/utils/sourcemap/magic_source.js"
|
|
21
21
|
import { composeTwoSourcemaps } from "@jsenv/utils/sourcemap/sourcemap_composition_v3.js"
|
|
22
22
|
|
|
@@ -11,8 +11,10 @@ import {
|
|
|
11
11
|
injectScriptAsEarlyAsPossible,
|
|
12
12
|
createHtmlNode,
|
|
13
13
|
} from "@jsenv/utils/html_ast/html_ast.js"
|
|
14
|
-
import {
|
|
15
|
-
|
|
14
|
+
import {
|
|
15
|
+
generateInlineContentUrl,
|
|
16
|
+
injectQueryParamsIntoSpecifier,
|
|
17
|
+
} from "@jsenv/urls"
|
|
16
18
|
|
|
17
19
|
export const jsenvPluginAsJsClassicHtml = ({
|
|
18
20
|
systemJsInjection,
|
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
* But for now (as it is simpler) we let the browser throw the error
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { urlToFilename } from "@jsenv/
|
|
13
|
+
import { urlToFilename, injectQueryParams } from "@jsenv/urls"
|
|
14
14
|
|
|
15
|
-
import { injectQueryParams } from "@jsenv/utils/urls/url_utils.js"
|
|
16
15
|
import { JS_QUOTES } from "@jsenv/utils/string/js_quotes.js"
|
|
17
16
|
|
|
18
17
|
export const jsenvPluginImportAssertions = () => {
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
normalizeStructuredMetaMap,
|
|
3
|
-
urlToMeta,
|
|
4
|
-
urlToRelativeUrl,
|
|
5
|
-
} from "@jsenv/filesystem"
|
|
1
|
+
import { urlToRelativeUrl, URL_META } from "@jsenv/urls"
|
|
6
2
|
|
|
7
3
|
import { parseAndTransformHtmlUrls } from "./html/html_urls.js"
|
|
8
4
|
import { parseAndTransformCssUrls } from "./css/css_urls.js"
|
|
@@ -12,18 +8,13 @@ import { parseAndTransformWebmanifestUrls } from "./webmanifest/webmanifest_urls
|
|
|
12
8
|
export const jsenvPluginUrlAnalysis = ({ rootDirectoryUrl, include }) => {
|
|
13
9
|
let getIncludeInfo = () => undefined
|
|
14
10
|
if (include) {
|
|
15
|
-
const
|
|
16
|
-
{
|
|
17
|
-
include,
|
|
18
|
-
},
|
|
11
|
+
const associations = URL_META.resolveAssociations(
|
|
12
|
+
{ include },
|
|
19
13
|
rootDirectoryUrl,
|
|
20
14
|
)
|
|
21
15
|
getIncludeInfo = (url) => {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
structuredMetaMap: includeMetaMap,
|
|
25
|
-
})
|
|
26
|
-
return meta.include
|
|
16
|
+
const { include } = URL_META.applyAssociations({ url, associations })
|
|
17
|
+
return include
|
|
27
18
|
}
|
|
28
19
|
}
|
|
29
20
|
|
package/src/test/execute_plan.js
CHANGED
|
@@ -3,17 +3,15 @@ import { memoryUsage } from "node:process"
|
|
|
3
3
|
import wrapAnsi from "wrap-ansi"
|
|
4
4
|
import stripAnsi from "strip-ansi"
|
|
5
5
|
import cuid from "cuid"
|
|
6
|
+
import { URL_META, urlToFileSystemPath } from "@jsenv/urls"
|
|
7
|
+
import { createDetailedMessage, loggerToLevels } from "@jsenv/logger"
|
|
8
|
+
import { createLog, startSpinner } from "@jsenv/log"
|
|
9
|
+
import { Abort, raceProcessTeardownEvents } from "@jsenv/abort"
|
|
6
10
|
import {
|
|
7
|
-
urlToFileSystemPath,
|
|
8
11
|
writeDirectory,
|
|
9
12
|
ensureEmptyDirectory,
|
|
10
|
-
normalizeStructuredMetaMap,
|
|
11
|
-
urlToMeta,
|
|
12
13
|
writeFileSync,
|
|
13
14
|
} from "@jsenv/filesystem"
|
|
14
|
-
import { createDetailedMessage, loggerToLevels } from "@jsenv/logger"
|
|
15
|
-
import { createLog, startSpinner } from "@jsenv/log"
|
|
16
|
-
import { Abort, raceProcessTeardownEvents } from "@jsenv/abort"
|
|
17
15
|
|
|
18
16
|
import { babelPluginInstrument } from "@jsenv/utils/coverage/babel_plugin_instrument.js"
|
|
19
17
|
import { reportToCoverage } from "@jsenv/utils/coverage/report_to_coverage.js"
|
|
@@ -231,17 +229,16 @@ export const executePlan = async (
|
|
|
231
229
|
).href
|
|
232
230
|
|
|
233
231
|
if (coverage) {
|
|
234
|
-
const
|
|
235
|
-
{
|
|
236
|
-
cover: coverageConfig,
|
|
237
|
-
},
|
|
232
|
+
const associations = URL_META.resolveAssociations(
|
|
233
|
+
{ cover: coverageConfig },
|
|
238
234
|
rootDirectoryUrl,
|
|
239
235
|
)
|
|
240
236
|
const urlShouldBeCovered = (url) => {
|
|
241
|
-
|
|
237
|
+
const { cover } = URL_META.applyAssociations({
|
|
242
238
|
url: new URL(url, rootDirectoryUrl).href,
|
|
243
|
-
|
|
244
|
-
})
|
|
239
|
+
associations,
|
|
240
|
+
})
|
|
241
|
+
return cover
|
|
245
242
|
}
|
|
246
243
|
runtimeParams.urlShouldBeCovered = urlShouldBeCovered
|
|
247
244
|
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
+
import { urlToFileSystemPath, resolveDirectoryUrl, URL_META } from "@jsenv/urls"
|
|
1
2
|
import {
|
|
2
|
-
normalizeStructuredMetaMap,
|
|
3
|
-
urlToFileSystemPath,
|
|
4
3
|
ensureEmptyDirectory,
|
|
5
|
-
resolveDirectoryUrl,
|
|
6
|
-
urlToMeta,
|
|
7
4
|
assertAndNormalizeDirectoryUrl,
|
|
8
5
|
} from "@jsenv/filesystem"
|
|
9
6
|
import { createLogger, createDetailedMessage } from "@jsenv/logger"
|
|
@@ -113,25 +110,22 @@ export const executeTestPlan = async ({
|
|
|
113
110
|
)
|
|
114
111
|
}
|
|
115
112
|
if (!coverageAndExecutionAllowed) {
|
|
116
|
-
const
|
|
117
|
-
{
|
|
118
|
-
execute: testPlan,
|
|
119
|
-
},
|
|
113
|
+
const associationsForExecute = URL_META.resolveAssociations(
|
|
114
|
+
{ execute: testPlan },
|
|
120
115
|
"file:///",
|
|
121
116
|
)
|
|
122
|
-
const
|
|
123
|
-
{
|
|
124
|
-
cover: coverageConfig,
|
|
125
|
-
},
|
|
117
|
+
const associationsForCover = URL_META.resolveAssociations(
|
|
118
|
+
{ cover: coverageConfig },
|
|
126
119
|
"file:///",
|
|
127
120
|
)
|
|
128
121
|
const patternsMatchingCoverAndExecute = Object.keys(
|
|
129
|
-
|
|
122
|
+
associationsForExecute.execute,
|
|
130
123
|
).filter((testPlanPattern) => {
|
|
131
|
-
|
|
124
|
+
const { cover } = URL_META.applyAssociations({
|
|
132
125
|
url: testPlanPattern,
|
|
133
|
-
|
|
134
|
-
})
|
|
126
|
+
associations: associationsForCover,
|
|
127
|
+
})
|
|
128
|
+
return cover
|
|
135
129
|
})
|
|
136
130
|
if (patternsMatchingCoverAndExecute.length) {
|
|
137
131
|
// It would be strange, for a given file to be both covered and executed
|
|
@@ -5,13 +5,10 @@ export const generateExecutionSteps = async (
|
|
|
5
5
|
plan,
|
|
6
6
|
{ signal, rootDirectoryUrl },
|
|
7
7
|
) => {
|
|
8
|
-
const structuredMetaMap = {
|
|
9
|
-
filePlan: plan,
|
|
10
|
-
}
|
|
11
8
|
const fileResultArray = await collectFiles({
|
|
12
9
|
signal,
|
|
13
10
|
directoryUrl: rootDirectoryUrl,
|
|
14
|
-
|
|
11
|
+
associations: { filePlan: plan },
|
|
15
12
|
predicate: ({ filePlan }) => filePlan,
|
|
16
13
|
})
|
|
17
14
|
const executionSteps = []
|