@jsenv/core 27.0.0-alpha.65 → 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/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/AsyncGenerator/AsyncGenerator.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/AwaitValue/AwaitValue.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/applyDecoratorDescriptor/applyDecoratorDescriptor.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/arrayLikeToArray/arrayLikeToArray.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/arrayWithHoles/arrayWithHoles.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/arrayWithoutHoles/arrayWithoutHoles.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/assertThisInitialized/assertThisInitialized.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/asyncGeneratorDelegate/asyncGeneratorDelegate.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/asyncIterator/asyncIterator.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/asyncToGenerator/asyncToGenerator.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/awaitAsyncGenerator/awaitAsyncGenerator.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classApplyDescriptorDestructureSet/classApplyDescriptorDestructureSet.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classApplyDescriptorGet/classApplyDescriptorGet.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classApplyDescriptorSet/classApplyDescriptorSet.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classCallCheck/classCallCheck.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classCheckPrivateStaticAccess/classCheckPrivateStaticAccess.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classCheckPrivateStaticFieldDescriptor/classCheckPrivateStaticFieldDescriptor.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classExtractFieldDescriptor/classExtractFieldDescriptor.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classNameTDZError/classNameTDZError.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classPrivateFieldDestructureSet/classPrivateFieldDestructureSet.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classPrivateFieldGet/classPrivateFieldGet.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classPrivateFieldLooseBase/classPrivateFieldLooseBase.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classPrivateFieldLooseKey/classPrivateFieldLooseKey.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classPrivateFieldSet/classPrivateFieldSet.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classPrivateMethodGet/classPrivateMethodGet.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classPrivateMethodSet/classPrivateMethodSet.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classStaticPrivateFieldSpecGet/classStaticPrivateFieldSpecGet.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classStaticPrivateFieldSpecSet/classStaticPrivateFieldSpecSet.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classStaticPrivateMethodGet/classStaticPrivateMethodGet.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/classStaticPrivateMethodSet/classStaticPrivateMethodSet.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/construct/construct.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/createClass/createClass.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/createForOfIteratorHelper/createForOfIteratorHelper.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/createForOfIteratorHelperLoose/createForOfIteratorHelperLoose.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/createRawReactElement/createRawReactElement.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/createSuper/createSuper.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/decorate/decorate.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/defaults/defaults.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/defineEnumerableProperties/defineEnumerableProperties.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/defineProperty/defineProperty.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/extends/extends.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/get/get.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/getPrototypeOf/getPrototypeOf.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/inherits/inherits.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/inheritsLoose/inheritsLoose.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/initializerDefineProperty/initializerDefineProperty.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/initializerWarningHelper/initializerWarningHelper.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/instanceof/instanceof.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/interopRequireDefault/interopRequireDefault.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/interopRequireWildcard/interopRequireWildcard.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/isNativeFunction/isNativeFunction.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/isNativeReflectConstruct/isNativeReflectConstruct.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/iterableToArray/iterableToArray.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/iterableToArrayLimit/iterableToArrayLimit.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/iterableToArrayLimitLoose/iterableToArrayLimitLoose.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/jsx/jsx.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/maybeArrayLike/maybeArrayLike.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/newArrowCheck/newArrowCheck.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/nonIterableRest/nonIterableRest.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/nonIterableSpread/nonIterableSpread.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/objectDestructuringEmpty/objectDestructuringEmpty.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/objectSpread/objectSpread.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/objectSpread2/objectSpread2.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/objectWithoutProperties/objectWithoutProperties.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/objectWithoutPropertiesLoose/objectWithoutPropertiesLoose.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/possibleConstructorReturn/possibleConstructorReturn.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/readOnlyError/readOnlyError.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/readme.md +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/set/set.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/setPrototypeOf/setPrototypeOf.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/skipFirstGeneratorNext/skipFirstGeneratorNext.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/slicedToArray/slicedToArray.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/slicedToArrayLoose/slicedToArrayLoose.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/superPropBase/superPropBase.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/taggedTemplateLiteral/taggedTemplateLiteral.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/taggedTemplateLiteralLoose/taggedTemplateLiteralLoose.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/tdz/tdz.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/temporalRef/temporalRef.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/temporalUndefined/temporalUndefined.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/toArray/toArray.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/toConsumableArray/toConsumableArray.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/toPrimitive/toPrimitive.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/toPropertyKey/toPropertyKey.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/typeof/typeof.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/unsupportedIterableToArray/unsupportedIterableToArray.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/wrapAsyncGenerator/wrapAsyncGenerator.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/wrapNativeSuper/wrapNativeSuper.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/wrapRegExp/wrapRegExp.js +0 -0
- package/dist/{node_modules/@jsenv/babel-plugins/src/babel_helpers → babel_helpers}/writeOnlyError/writeOnlyError.js +0 -0
- package/dist/html/explorer.html +1 -1
- package/dist/main.js +182 -92
- package/dist/s.js +626 -0
- package/dist/s.js.map +204 -0
- package/package.json +8 -7
- package/src/build/build.js +27 -11
- package/src/build/build_urls_generator.js +1 -1
- package/src/build/resync_ressource_hints.js +1 -1
- package/src/build/start_build_server.js +1 -1
- package/src/dev/plugins/explorer/client/explorer.html +1 -1
- package/src/dev/plugins/explorer/jsenv_plugin_explorer.js +6 -10
- 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/errors.js +2 -2
- package/src/omega/file_url_converter.js +1 -1
- package/src/omega/kitchen.js +49 -7
- package/src/omega/server/file_service.js +2 -2
- package/src/omega/url_graph/url_info_transformations.js +12 -6
- package/src/omega/url_graph.js +3 -2
- 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 +44 -30
- 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 +3 -3
- package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic.js +12 -8
- 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 +10 -6
- package/src/plugins/url_analysis/css/css_urls.js +1 -1
- package/src/plugins/url_analysis/html/html_urls.js +1 -1
- package/src/plugins/url_analysis/js/js_urls.js +1 -1
- package/src/plugins/url_analysis/jsenv_plugin_url_analysis.js +16 -18
- package/src/test/execute_plan.js +11 -14
- 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,17 +11,13 @@ 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
|
-
import { statSync, readdirSync, readFileSync,
|
|
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
|
-
import { fetchOriginalUrlInfo } from "@jsenv/utils/graph/fetch_original_url_info.js";
|
|
25
21
|
import { createRequire } from "node:module";
|
|
26
22
|
import { composeTwoSourcemaps } from "@jsenv/utils/sourcemap/sourcemap_composition_v3.js";
|
|
27
23
|
import babelParser from "@babel/parser";
|
|
@@ -32,7 +28,6 @@ import { applyRollupPlugins } from "@jsenv/utils/js_ast/apply_rollup_plugins.js"
|
|
|
32
28
|
import { sourcemapConverter } from "@jsenv/utils/sourcemap/sourcemap_converter.js";
|
|
33
29
|
import { createCallbackList, createCallbackListNotifiedOnce, Abort, raceCallbacks, raceProcessTeardownEvents } from "@jsenv/abort";
|
|
34
30
|
import { createSSEService } from "@jsenv/utils/event_source/sse_service.js";
|
|
35
|
-
import { stringifyUrlSite } from "@jsenv/utils/urls/url_trace.js";
|
|
36
31
|
import { timeStart, fetchFileSystem, composeTwoResponses, serveDirectory, startServer, pluginCORS, jsenvAccessControlAllowedHeaders, pluginServerTiming, pluginRequestWaitingCheck, composeServices, findFreePort } from "@jsenv/server";
|
|
37
32
|
import { SOURCEMAP, generateSourcemapUrl, sourcemapToBase64Url } from "@jsenv/utils/sourcemap/sourcemap_utils.js";
|
|
38
33
|
import { validateResponseIntegrity } from "@jsenv/integrity";
|
|
@@ -58,7 +53,7 @@ import { uneval } from "@jsenv/uneval";
|
|
|
58
53
|
import { createVersionGenerator } from "@jsenv/utils/versioning/version_generator.js";
|
|
59
54
|
|
|
60
55
|
const parseAndTransformHtmlUrls = async (urlInfo, context) => {
|
|
61
|
-
const url = urlInfo.
|
|
56
|
+
const url = urlInfo.originalUrl;
|
|
62
57
|
const content = urlInfo.content;
|
|
63
58
|
const {
|
|
64
59
|
scenario,
|
|
@@ -368,7 +363,7 @@ const parseAndTransformCssUrls = async (urlInfo, context) => {
|
|
|
368
363
|
});
|
|
369
364
|
}
|
|
370
365
|
})],
|
|
371
|
-
url: urlInfo.
|
|
366
|
+
url: urlInfo.originalUrl,
|
|
372
367
|
content: urlInfo.content
|
|
373
368
|
});
|
|
374
369
|
await Promise.all(actions.map(action => action()));
|
|
@@ -409,7 +404,7 @@ const isWebWorkerUrlInfo = urlInfo => {
|
|
|
409
404
|
const parseAndTransformJsUrls = async (urlInfo, context) => {
|
|
410
405
|
const jsMentions = await parseJsUrls({
|
|
411
406
|
js: urlInfo.content,
|
|
412
|
-
url: urlInfo.
|
|
407
|
+
url: urlInfo.originalUrl,
|
|
413
408
|
isJsModule: urlInfo.type === "js_module",
|
|
414
409
|
isWebWorker: isWebWorkerUrlInfo(urlInfo)
|
|
415
410
|
});
|
|
@@ -513,16 +508,18 @@ const jsenvPluginUrlAnalysis = ({
|
|
|
513
508
|
let getIncludeInfo = () => undefined;
|
|
514
509
|
|
|
515
510
|
if (include) {
|
|
516
|
-
const
|
|
511
|
+
const associations = URL_META.resolveAssociations({
|
|
517
512
|
include
|
|
518
513
|
}, rootDirectoryUrl);
|
|
519
514
|
|
|
520
515
|
getIncludeInfo = url => {
|
|
521
|
-
const
|
|
516
|
+
const {
|
|
517
|
+
include
|
|
518
|
+
} = URL_META.applyAssociations({
|
|
522
519
|
url,
|
|
523
|
-
|
|
520
|
+
associations
|
|
524
521
|
});
|
|
525
|
-
return
|
|
522
|
+
return include;
|
|
526
523
|
};
|
|
527
524
|
}
|
|
528
525
|
|
|
@@ -530,7 +527,11 @@ const jsenvPluginUrlAnalysis = ({
|
|
|
530
527
|
name: "jsenv:url_analysis",
|
|
531
528
|
appliesDuring: "*",
|
|
532
529
|
redirectUrl: reference => {
|
|
533
|
-
if (reference.specifier[0] === "#"
|
|
530
|
+
if (reference.specifier[0] === "#" && // For Html, css and in general "#" refer to a ressource in the page
|
|
531
|
+
// so that urls must be kept intact
|
|
532
|
+
// However for js import specifiers they have a different meaning and we want
|
|
533
|
+
// to resolve them (https://nodejs.org/api/packages.html#imports for instance)
|
|
534
|
+
reference.type !== "js_import_export") {
|
|
534
535
|
reference.shouldHandle = false;
|
|
535
536
|
return;
|
|
536
537
|
}
|
|
@@ -566,12 +567,12 @@ const jsenvPluginUrlAnalysis = ({
|
|
|
566
567
|
directory: (urlInfo, context) => {
|
|
567
568
|
const originalDirectoryReference = findOriginalDirectoryReference(urlInfo, context);
|
|
568
569
|
const directoryRelativeUrl = urlToRelativeUrl(urlInfo.url, context.rootDirectoryUrl);
|
|
569
|
-
JSON.parse(urlInfo.content).forEach(
|
|
570
|
+
JSON.parse(urlInfo.content).forEach(directoryEntryName => {
|
|
570
571
|
context.referenceUtils.found({
|
|
571
572
|
type: "filesystem",
|
|
572
573
|
subtype: "directory_entry",
|
|
573
|
-
specifier:
|
|
574
|
-
trace: `"${directoryRelativeUrl}${
|
|
574
|
+
specifier: directoryEntryName,
|
|
575
|
+
trace: `"${directoryRelativeUrl}${directoryEntryName}" entry in directory referenced by ${originalDirectoryReference.trace}`
|
|
575
576
|
});
|
|
576
577
|
});
|
|
577
578
|
}
|
|
@@ -1106,36 +1107,33 @@ const jsenvPluginFileUrls = ({
|
|
|
1106
1107
|
search,
|
|
1107
1108
|
hash
|
|
1108
1109
|
} = urlObject;
|
|
1109
|
-
|
|
1110
|
-
const resolveSymlink = fileUrl => {
|
|
1111
|
-
const realPath = realpathSync(new URL(fileUrl));
|
|
1112
|
-
const realFileUrl = `${pathToFileURL(realPath)}${search}${hash}`;
|
|
1113
|
-
return realFileUrl;
|
|
1114
|
-
};
|
|
1115
|
-
|
|
1116
1110
|
let {
|
|
1117
1111
|
pathname
|
|
1118
1112
|
} = urlObject;
|
|
1119
1113
|
const pathnameUsesTrailingSlash = pathname.endsWith("/");
|
|
1120
1114
|
urlObject.search = "";
|
|
1121
|
-
urlObject.hash = "";
|
|
1115
|
+
urlObject.hash = "";
|
|
1116
|
+
const foundADirectory = stat && stat.isDirectory();
|
|
1117
|
+
const foundSomething = stat && !foundADirectory; // force trailing slash on directories
|
|
1122
1118
|
|
|
1123
|
-
if (
|
|
1124
|
-
|
|
1119
|
+
if (foundADirectory && !pathnameUsesTrailingSlash) {
|
|
1120
|
+
urlObject.pathname = `${pathname}/`;
|
|
1121
|
+
} // otherwise remove trailing slash if any
|
|
1125
1122
|
|
|
1126
|
-
if (!pathnameUsesTrailingSlash) {
|
|
1127
|
-
urlObject.pathname = `${pathname}/`;
|
|
1128
|
-
}
|
|
1129
1123
|
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
} // give a chane to magic resolution if enabled
|
|
1133
|
-
|
|
1134
|
-
} else if (pathnameUsesTrailingSlash) {
|
|
1135
|
-
// a warning would be great because it's strange to reference a file with a trailing slash
|
|
1124
|
+
if (foundSomething && pathnameUsesTrailingSlash) {
|
|
1125
|
+
// a warning here? (because it's strange to reference a file with a trailing slash)
|
|
1136
1126
|
urlObject.pathname = pathname.slice(0, -1);
|
|
1137
1127
|
}
|
|
1138
1128
|
|
|
1129
|
+
if (foundADirectory && directoryReferenceAllowed) {
|
|
1130
|
+
reference.data.foundADirectory = true;
|
|
1131
|
+
const directoryFacadeUrl = urlObject.href;
|
|
1132
|
+
const directoryUrlRaw = preservesSymlink ? directoryFacadeUrl : resolveSymlink(directoryFacadeUrl);
|
|
1133
|
+
const directoryUrl = `${directoryUrlRaw}${search}${hash}`;
|
|
1134
|
+
return directoryUrl;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1139
1137
|
const url = urlObject.href;
|
|
1140
1138
|
const filesystemResolution = applyFileSystemMagicResolution(url, {
|
|
1141
1139
|
fileStat: stat,
|
|
@@ -1144,12 +1142,15 @@ const jsenvPluginFileUrls = ({
|
|
|
1144
1142
|
});
|
|
1145
1143
|
|
|
1146
1144
|
if (!filesystemResolution.found) {
|
|
1145
|
+
reference.data.foundADirectory = foundADirectory;
|
|
1147
1146
|
return null;
|
|
1148
1147
|
}
|
|
1149
1148
|
|
|
1150
|
-
|
|
1149
|
+
reference.data.foundADirectory = filesystemResolution.isDirectory;
|
|
1150
|
+
const fileFacadeUrl = filesystemResolution.url;
|
|
1151
|
+
const fileUrlRaw = preservesSymlink ? fileFacadeUrl : resolveSymlink(fileFacadeUrl);
|
|
1151
1152
|
const fileUrl = `${fileUrlRaw}${search}${hash}`;
|
|
1152
|
-
return
|
|
1153
|
+
return fileUrl;
|
|
1153
1154
|
}
|
|
1154
1155
|
}, {
|
|
1155
1156
|
name: "jsenv:filesystem_resolution",
|
|
@@ -1203,19 +1204,28 @@ const jsenvPluginFileUrls = ({
|
|
|
1203
1204
|
|
|
1204
1205
|
const urlObject = new URL(urlInfo.url);
|
|
1205
1206
|
|
|
1206
|
-
if (context.reference.
|
|
1207
|
+
if (context.reference.data.foundADirectory) {
|
|
1207
1208
|
if (directoryReferenceAllowed) {
|
|
1208
1209
|
const directoryEntries = readdirSync(urlObject);
|
|
1210
|
+
let filename;
|
|
1211
|
+
|
|
1212
|
+
if (context.reference.type === "filesystem") {
|
|
1213
|
+
const parentUrlInfo = context.urlGraph.getUrlInfo(context.reference.parentUrl);
|
|
1214
|
+
filename = `${parentUrlInfo.filename}${context.reference.specifier}/`;
|
|
1215
|
+
} else {
|
|
1216
|
+
filename = `${urlToFilename(urlInfo.url)}/`;
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1209
1219
|
return {
|
|
1210
1220
|
type: "directory",
|
|
1211
1221
|
contentType: "application/json",
|
|
1212
1222
|
content: JSON.stringify(directoryEntries, null, " "),
|
|
1213
|
-
filename
|
|
1223
|
+
filename
|
|
1214
1224
|
};
|
|
1215
1225
|
}
|
|
1216
1226
|
|
|
1217
1227
|
const error = new Error("found a directory on filesystem");
|
|
1218
|
-
error.code = "
|
|
1228
|
+
error.code = "DIRECTORY_REFERENCE_NOT_ALLOWED";
|
|
1219
1229
|
throw error;
|
|
1220
1230
|
}
|
|
1221
1231
|
|
|
@@ -1237,6 +1247,10 @@ const jsenvPluginFileUrls = ({
|
|
|
1237
1247
|
}];
|
|
1238
1248
|
};
|
|
1239
1249
|
|
|
1250
|
+
const resolveSymlink = fileUrl => {
|
|
1251
|
+
return pathToFileURL(realpathSync(new URL(fileUrl))).href;
|
|
1252
|
+
};
|
|
1253
|
+
|
|
1240
1254
|
const jsenvPluginHttpUrls = () => {
|
|
1241
1255
|
return {
|
|
1242
1256
|
name: "jsenv:http_urls",
|
|
@@ -1422,7 +1436,7 @@ const jsenvPluginJsInlineContent = ({
|
|
|
1422
1436
|
const parseAndTransformInlineContentCalls = async (urlInfo, context) => {
|
|
1423
1437
|
const inlineContentInfos = await parseJsInlineContentInfos({
|
|
1424
1438
|
js: urlInfo.content,
|
|
1425
|
-
url: urlInfo.
|
|
1439
|
+
url: urlInfo.originalUrl,
|
|
1426
1440
|
isJsModule: urlInfo.type === "js_module"
|
|
1427
1441
|
});
|
|
1428
1442
|
|
|
@@ -1508,7 +1522,7 @@ const parseJsInlineContentInfos = async ({
|
|
|
1508
1522
|
} = await applyBabelPlugins({
|
|
1509
1523
|
babelPlugins: [babelPluginMetadataInlineContents],
|
|
1510
1524
|
urlInfo: {
|
|
1511
|
-
url,
|
|
1525
|
+
originalUrl: url,
|
|
1512
1526
|
type: isJsModule ? "js_module" : "js_classic",
|
|
1513
1527
|
content: js
|
|
1514
1528
|
}
|
|
@@ -2615,7 +2629,7 @@ const jsenvPluginAsModules = () => {
|
|
|
2615
2629
|
name: `jsenv:as_json_module`,
|
|
2616
2630
|
appliesDuring: "*",
|
|
2617
2631
|
fetchUrlContent: async (urlInfo, context) => {
|
|
2618
|
-
const originalUrlInfo = await fetchOriginalUrlInfo({
|
|
2632
|
+
const originalUrlInfo = await context.fetchOriginalUrlInfo({
|
|
2619
2633
|
urlInfo,
|
|
2620
2634
|
context,
|
|
2621
2635
|
searchParam: "as_json_module",
|
|
@@ -2628,6 +2642,8 @@ const jsenvPluginAsModules = () => {
|
|
|
2628
2642
|
|
|
2629
2643
|
const jsonText = JSON.stringify(originalUrlInfo.content.trim());
|
|
2630
2644
|
return {
|
|
2645
|
+
originalUrl: originalUrlInfo.originalUrl,
|
|
2646
|
+
originalContent: originalUrlInfo.originalContent,
|
|
2631
2647
|
type: "js_module",
|
|
2632
2648
|
contentType: "text/javascript",
|
|
2633
2649
|
// here we could `export default ${jsonText}`:
|
|
@@ -2641,7 +2657,7 @@ const jsenvPluginAsModules = () => {
|
|
|
2641
2657
|
name: `jsenv:as_css_module`,
|
|
2642
2658
|
appliesDuring: "*",
|
|
2643
2659
|
fetchUrlContent: async (urlInfo, context) => {
|
|
2644
|
-
const originalUrlInfo = await fetchOriginalUrlInfo({
|
|
2660
|
+
const originalUrlInfo = await context.fetchOriginalUrlInfo({
|
|
2645
2661
|
urlInfo,
|
|
2646
2662
|
context,
|
|
2647
2663
|
searchParam: "as_css_module",
|
|
@@ -2659,6 +2675,8 @@ const jsenvPluginAsModules = () => {
|
|
|
2659
2675
|
canUseTemplateString: true
|
|
2660
2676
|
});
|
|
2661
2677
|
return {
|
|
2678
|
+
originalUrl: originalUrlInfo.originalUrl,
|
|
2679
|
+
originalContent: originalUrlInfo.originalContent,
|
|
2662
2680
|
type: "js_module",
|
|
2663
2681
|
contentType: "text/javascript",
|
|
2664
2682
|
content: `import { InlineContent } from ${JSON.stringify(inlineContentClientFileUrl)}
|
|
@@ -2674,7 +2692,7 @@ const jsenvPluginAsModules = () => {
|
|
|
2674
2692
|
name: `jsenv:as_text_module`,
|
|
2675
2693
|
appliesDuring: "*",
|
|
2676
2694
|
fetchUrlContent: async (urlInfo, context) => {
|
|
2677
|
-
const originalUrlInfo = await fetchOriginalUrlInfo({
|
|
2695
|
+
const originalUrlInfo = await context.fetchOriginalUrlInfo({
|
|
2678
2696
|
urlInfo,
|
|
2679
2697
|
context,
|
|
2680
2698
|
searchParam: "as_text_module",
|
|
@@ -2692,6 +2710,8 @@ const jsenvPluginAsModules = () => {
|
|
|
2692
2710
|
canUseTemplateString: true
|
|
2693
2711
|
});
|
|
2694
2712
|
return {
|
|
2713
|
+
originalUrl: originalUrlInfo.originalUrl,
|
|
2714
|
+
originalContent: originalUrlInfo.originalContent,
|
|
2695
2715
|
type: "js_module",
|
|
2696
2716
|
contentType: "text/javascript",
|
|
2697
2717
|
content: `import { InlineContent } from ${JSON.stringify(inlineContentClientFileUrl)}
|
|
@@ -2707,7 +2727,7 @@ export default inlineContent.text`
|
|
|
2707
2727
|
// https://github.com/babel/babel/blob/99f4f6c3b03c7f3f67cf1b9f1a21b80cfd5b0224/packages/babel-core/src/tools/build-external-helpers.js
|
|
2708
2728
|
// the list of possible helpers:
|
|
2709
2729
|
// https://github.com/babel/babel/blob/99f4f6c3b03c7f3f67cf1b9f1a21b80cfd5b0224/packages/babel-helpers/src/helpers.js#L13
|
|
2710
|
-
const babelHelperClientDirectoryUrl = new URL("./
|
|
2730
|
+
const babelHelperClientDirectoryUrl = new URL("./babel_helpers/", import.meta.url).href; // we cannot use "@jsenv/core/src/*" because babel helper might be injected
|
|
2711
2731
|
// into node_modules not depending on "@jsenv/core"
|
|
2712
2732
|
|
|
2713
2733
|
const getBabelHelperFileUrl = babelHelperName => {
|
|
@@ -3167,7 +3187,7 @@ const jsenvPluginAsJsClassicConversion = ({
|
|
|
3167
3187
|
}
|
|
3168
3188
|
},
|
|
3169
3189
|
fetchUrlContent: async (urlInfo, context) => {
|
|
3170
|
-
const originalUrlInfo = await fetchOriginalUrlInfo({
|
|
3190
|
+
const originalUrlInfo = await context.fetchOriginalUrlInfo({
|
|
3171
3191
|
urlInfo,
|
|
3172
3192
|
context,
|
|
3173
3193
|
searchParam: "as_js_classic",
|
|
@@ -3203,6 +3223,8 @@ const jsenvPluginAsJsClassicConversion = ({
|
|
|
3203
3223
|
});
|
|
3204
3224
|
urlInfo.data.jsClassicFormat = jsClassicFormat;
|
|
3205
3225
|
return {
|
|
3226
|
+
originalUrl: originalUrlInfo.originalUrl,
|
|
3227
|
+
originalContent: originalUrlInfo.originalContent,
|
|
3206
3228
|
type: "js_classic",
|
|
3207
3229
|
contentType: "text/javascript",
|
|
3208
3230
|
content,
|
|
@@ -3256,6 +3278,8 @@ const convertJsModuleToJsClassic = async ({
|
|
|
3256
3278
|
}], babelPluginTransformImportMetaUrl, require$3("@babel/plugin-transform-modules-umd")])],
|
|
3257
3279
|
urlInfo
|
|
3258
3280
|
});
|
|
3281
|
+
let sourcemap = urlInfo.sourcemap;
|
|
3282
|
+
sourcemap = await composeTwoSourcemaps(sourcemap, map);
|
|
3259
3283
|
|
|
3260
3284
|
if (systemJsInjection && jsClassicFormat === "system" && isJsEntryPoint) {
|
|
3261
3285
|
const magicSource = createMagicSource(code);
|
|
@@ -3263,19 +3287,17 @@ const convertJsModuleToJsClassic = async ({
|
|
|
3263
3287
|
as: "string"
|
|
3264
3288
|
});
|
|
3265
3289
|
magicSource.prepend(`${systemjsCode}\n\n`);
|
|
3266
|
-
const
|
|
3267
|
-
|
|
3268
|
-
sourcemap
|
|
3269
|
-
} = magicSource.toContentAndSourcemap();
|
|
3290
|
+
const magicResult = magicSource.toContentAndSourcemap();
|
|
3291
|
+
sourcemap = await composeTwoSourcemaps(sourcemap, magicResult.sourcemap);
|
|
3270
3292
|
return {
|
|
3271
|
-
content,
|
|
3272
|
-
sourcemap
|
|
3293
|
+
content: magicResult.content,
|
|
3294
|
+
sourcemap
|
|
3273
3295
|
};
|
|
3274
3296
|
}
|
|
3275
3297
|
|
|
3276
3298
|
return {
|
|
3277
3299
|
content: code,
|
|
3278
|
-
sourcemap
|
|
3300
|
+
sourcemap
|
|
3279
3301
|
};
|
|
3280
3302
|
};
|
|
3281
3303
|
|
|
@@ -4834,14 +4856,14 @@ const rollupPluginJsenv = ({
|
|
|
4834
4856
|
let importCanBeBundled = () => true;
|
|
4835
4857
|
|
|
4836
4858
|
if (include) {
|
|
4837
|
-
const
|
|
4859
|
+
const associations = URL_META.resolveAssociations({
|
|
4838
4860
|
bundle: include
|
|
4839
4861
|
}, rootDirectoryUrl);
|
|
4840
4862
|
|
|
4841
4863
|
importCanBeBundled = url => {
|
|
4842
|
-
return
|
|
4864
|
+
return URL_META.applyAssociations({
|
|
4843
4865
|
url,
|
|
4844
|
-
|
|
4866
|
+
associations
|
|
4845
4867
|
}).bundle;
|
|
4846
4868
|
};
|
|
4847
4869
|
}
|
|
@@ -6340,8 +6362,9 @@ const createUrlInfo = url => {
|
|
|
6340
6362
|
contentType: "",
|
|
6341
6363
|
// "text/html", "text/css", "text/javascript", "application/json", ...
|
|
6342
6364
|
url,
|
|
6343
|
-
|
|
6365
|
+
originalUrl: undefined,
|
|
6344
6366
|
generatedUrl: null,
|
|
6367
|
+
filename: "",
|
|
6345
6368
|
isInline: false,
|
|
6346
6369
|
inlineUrlSite: null,
|
|
6347
6370
|
shouldHandle: undefined,
|
|
@@ -6685,7 +6708,7 @@ const createUrlInfoTransformer = ({
|
|
|
6685
6708
|
sourcemapsSourcesContent || urlInfo.isInline || sourcemap.sources && sourcemap.sources.some(source => !source || !source.startsWith("file:"));
|
|
6686
6709
|
|
|
6687
6710
|
if (sourcemap.sources && sourcemap.sources.length > 1) {
|
|
6688
|
-
sourcemap.sources = sourcemap.sources.map(source => new URL(source, urlInfo.
|
|
6711
|
+
sourcemap.sources = sourcemap.sources.map(source => new URL(source, urlInfo.originalUrl).href);
|
|
6689
6712
|
|
|
6690
6713
|
if (!wantSourcesContent) {
|
|
6691
6714
|
sourcemap.sourcesContent = undefined;
|
|
@@ -6694,7 +6717,7 @@ const createUrlInfoTransformer = ({
|
|
|
6694
6717
|
return sourcemap;
|
|
6695
6718
|
}
|
|
6696
6719
|
|
|
6697
|
-
sourcemap.sources = [urlInfo.
|
|
6720
|
+
sourcemap.sources = [urlInfo.originalUrl];
|
|
6698
6721
|
sourcemap.sourcesContent = [urlInfo.originalContent];
|
|
6699
6722
|
|
|
6700
6723
|
if (!wantSourcesContent) {
|
|
@@ -6730,6 +6753,7 @@ const createUrlInfoTransformer = ({
|
|
|
6730
6753
|
sourcemapUrlInfo.isInline = sourcemaps === "inline"; // already loaded during "load" hook (happens during build)
|
|
6731
6754
|
|
|
6732
6755
|
if (urlInfo.sourcemap) {
|
|
6756
|
+
urlInfo.sourcemap = normalizeSourcemap(urlInfo, urlInfo.sourcemap);
|
|
6733
6757
|
return;
|
|
6734
6758
|
} // check for existing sourcemap for this content
|
|
6735
6759
|
|
|
@@ -6758,8 +6782,9 @@ const createUrlInfoTransformer = ({
|
|
|
6758
6782
|
await context.cook(sourcemapUrlInfo, {
|
|
6759
6783
|
reference: sourcemapReference
|
|
6760
6784
|
});
|
|
6761
|
-
const
|
|
6762
|
-
|
|
6785
|
+
const sourcemapRaw = JSON.parse(sourcemapUrlInfo.content);
|
|
6786
|
+
const sourcemap = normalizeSourcemap(urlInfo, sourcemapRaw);
|
|
6787
|
+
urlInfo.sourcemap = sourcemap;
|
|
6763
6788
|
} catch (e) {
|
|
6764
6789
|
logger.error(`Error while handling existing sourcemap: ${e.message}`);
|
|
6765
6790
|
return;
|
|
@@ -6818,7 +6843,7 @@ const createUrlInfoTransformer = ({
|
|
|
6818
6843
|
if (sourcemapsRelativeSources) {
|
|
6819
6844
|
sourcemap.sources = sourcemap.sources.map(source => {
|
|
6820
6845
|
const sourceRelative = urlToRelativeUrl(source, urlInfo.url);
|
|
6821
|
-
return sourceRelative;
|
|
6846
|
+
return sourceRelative || ".";
|
|
6822
6847
|
});
|
|
6823
6848
|
}
|
|
6824
6849
|
|
|
@@ -6835,6 +6860,9 @@ const createUrlInfoTransformer = ({
|
|
|
6835
6860
|
specifier: sourcemaps === "file" && sourcemapsRelativeSources ? urlToRelativeUrl(sourcemapReference.url, urlInfo.url) : sourcemapReference.generatedSpecifier
|
|
6836
6861
|
});
|
|
6837
6862
|
}
|
|
6863
|
+
} else if (urlInfo.sourcemapReference) {
|
|
6864
|
+
// in the end we don't use the sourcemap placeholder
|
|
6865
|
+
urlGraph.deleteUrlInfo(urlInfo.sourcemapReference.url);
|
|
6838
6866
|
}
|
|
6839
6867
|
|
|
6840
6868
|
urlInfo.contentEtag = bufferToEtag(Buffer.from(urlInfo.content));
|
|
@@ -6912,9 +6940,9 @@ const createFetchUrlContentError = ({
|
|
|
6912
6940
|
});
|
|
6913
6941
|
}
|
|
6914
6942
|
|
|
6915
|
-
if (error.code === "
|
|
6943
|
+
if (error.code === "DIRECTORY_REFERENCE_NOT_ALLOWED") {
|
|
6916
6944
|
return createFailedToFetchUrlContentError({
|
|
6917
|
-
code: "
|
|
6945
|
+
code: "DIRECTORY_REFERENCE_NOT_ALLOWED",
|
|
6918
6946
|
reason: `found a directory on filesystem`
|
|
6919
6947
|
});
|
|
6920
6948
|
}
|
|
@@ -7280,6 +7308,7 @@ const createKitchen = ({
|
|
|
7280
7308
|
type,
|
|
7281
7309
|
subtype,
|
|
7282
7310
|
contentType = "application/octet-stream",
|
|
7311
|
+
originalUrl,
|
|
7283
7312
|
originalContent,
|
|
7284
7313
|
content,
|
|
7285
7314
|
sourcemap,
|
|
@@ -7294,8 +7323,9 @@ const createKitchen = ({
|
|
|
7294
7323
|
type: urlInfo.type,
|
|
7295
7324
|
subtype: urlInfo.subtype
|
|
7296
7325
|
});
|
|
7297
|
-
urlInfo.contentType = contentType; // during build urls info are reused and load returns originalContent
|
|
7326
|
+
urlInfo.contentType = contentType; // during build urls info are reused and load returns originalUrl/originalContent
|
|
7298
7327
|
|
|
7328
|
+
urlInfo.originalUrl = originalUrl || urlInfo.originalUrl;
|
|
7299
7329
|
urlInfo.originalContent = originalContent === undefined ? content : originalContent;
|
|
7300
7330
|
urlInfo.content = content;
|
|
7301
7331
|
urlInfo.sourcemap = sourcemap;
|
|
@@ -7618,6 +7648,45 @@ const createKitchen = ({
|
|
|
7618
7648
|
return [ref, urlInfo];
|
|
7619
7649
|
};
|
|
7620
7650
|
|
|
7651
|
+
const fetchOriginalUrlInfo = async ({
|
|
7652
|
+
urlInfo,
|
|
7653
|
+
context,
|
|
7654
|
+
searchParam,
|
|
7655
|
+
expectedType
|
|
7656
|
+
}) => {
|
|
7657
|
+
const urlObject = new URL(urlInfo.url);
|
|
7658
|
+
const {
|
|
7659
|
+
searchParams
|
|
7660
|
+
} = urlObject;
|
|
7661
|
+
|
|
7662
|
+
if (!searchParams.has(searchParam)) {
|
|
7663
|
+
return null;
|
|
7664
|
+
}
|
|
7665
|
+
|
|
7666
|
+
searchParams.delete(searchParam);
|
|
7667
|
+
const originalUrl = urlObject.href;
|
|
7668
|
+
const originalReference = { ...(context.reference.original || context.reference),
|
|
7669
|
+
expectedType
|
|
7670
|
+
};
|
|
7671
|
+
originalReference.url = originalUrl;
|
|
7672
|
+
const originalUrlInfo = context.urlGraph.reuseOrCreateUrlInfo(originalReference.url);
|
|
7673
|
+
|
|
7674
|
+
if (originalUrlInfo.originalUrl === undefined) {
|
|
7675
|
+
applyReferenceEffectsOnUrlInfo(originalReference, originalUrlInfo, context);
|
|
7676
|
+
}
|
|
7677
|
+
|
|
7678
|
+
await context.fetchUrlContent(originalUrlInfo, {
|
|
7679
|
+
reference: originalReference
|
|
7680
|
+
});
|
|
7681
|
+
|
|
7682
|
+
if (originalUrlInfo.dependents.size === 0) {
|
|
7683
|
+
context.urlGraph.deleteUrlInfo(originalUrlInfo.url);
|
|
7684
|
+
}
|
|
7685
|
+
|
|
7686
|
+
return originalUrlInfo;
|
|
7687
|
+
};
|
|
7688
|
+
|
|
7689
|
+
kitchenContext.fetchOriginalUrlInfo = fetchOriginalUrlInfo;
|
|
7621
7690
|
return {
|
|
7622
7691
|
pluginController,
|
|
7623
7692
|
urlInfoTransformer,
|
|
@@ -7673,6 +7742,7 @@ const applyReferenceEffectsOnUrlInfo = (reference, urlInfo, context) => {
|
|
|
7673
7742
|
urlInfo.shouldHandle = true;
|
|
7674
7743
|
}
|
|
7675
7744
|
|
|
7745
|
+
urlInfo.originalUrl = urlInfo.originalUrl || reference.url;
|
|
7676
7746
|
Object.assign(urlInfo.data, reference.data);
|
|
7677
7747
|
Object.assign(urlInfo.timing, reference.timing);
|
|
7678
7748
|
|
|
@@ -8061,7 +8131,7 @@ const createFileService = ({
|
|
|
8061
8131
|
};
|
|
8062
8132
|
}
|
|
8063
8133
|
|
|
8064
|
-
if (code === "
|
|
8134
|
+
if (code === "DIRECTORY_REFERENCE_NOT_ALLOWED") {
|
|
8065
8135
|
return serveDirectory(reference.url, {
|
|
8066
8136
|
headers: {
|
|
8067
8137
|
accept: "text/html"
|
|
@@ -8264,19 +8334,18 @@ const jsenvPluginExplorer = ({
|
|
|
8264
8334
|
return null;
|
|
8265
8335
|
}
|
|
8266
8336
|
|
|
8267
|
-
const
|
|
8337
|
+
const associationsForExplorable = {};
|
|
8268
8338
|
Object.keys(groups).forEach(groupName => {
|
|
8269
8339
|
const groupConfig = groups[groupName];
|
|
8270
|
-
|
|
8340
|
+
associationsForExplorable[groupName] = {
|
|
8271
8341
|
"**/.jsenv/": false,
|
|
8272
8342
|
// avoid visting .jsenv directory in jsenv itself
|
|
8273
8343
|
...groupConfig
|
|
8274
8344
|
};
|
|
8275
8345
|
});
|
|
8276
|
-
const structuredMetaMapForExplorable = normalizeStructuredMetaMap(structuredMetaMapRelativeForExplorable, rootDirectoryUrl);
|
|
8277
8346
|
const matchingFileResultArray = await collectFiles({
|
|
8278
8347
|
directoryUrl: rootDirectoryUrl,
|
|
8279
|
-
|
|
8348
|
+
associations: associationsForExplorable,
|
|
8280
8349
|
predicate: meta => Object.keys(meta).some(group => Boolean(meta[group]))
|
|
8281
8350
|
});
|
|
8282
8351
|
const files = matchingFileResultArray.map(({
|
|
@@ -8287,7 +8356,7 @@ const jsenvPluginExplorer = ({
|
|
|
8287
8356
|
meta
|
|
8288
8357
|
}));
|
|
8289
8358
|
let html = String(readFileSync(new URL(htmlClientFileUrl)));
|
|
8290
|
-
html = html.replace("FAVICON_HREF", DataUrl.stringify({
|
|
8359
|
+
html = html.replace("virtual:FAVICON_HREF", DataUrl.stringify({
|
|
8291
8360
|
contentType: CONTENT_TYPE.fromUrlExtension(faviconClientFileUrl),
|
|
8292
8361
|
base64Flag: true,
|
|
8293
8362
|
data: readFileSync(new URL(faviconClientFileUrl)).toString("base64")
|
|
@@ -8753,13 +8822,12 @@ const generateExecutionSteps = async (plan, {
|
|
|
8753
8822
|
signal,
|
|
8754
8823
|
rootDirectoryUrl
|
|
8755
8824
|
}) => {
|
|
8756
|
-
const structuredMetaMap = {
|
|
8757
|
-
filePlan: plan
|
|
8758
|
-
};
|
|
8759
8825
|
const fileResultArray = await collectFiles({
|
|
8760
8826
|
signal,
|
|
8761
8827
|
directoryUrl: rootDirectoryUrl,
|
|
8762
|
-
|
|
8828
|
+
associations: {
|
|
8829
|
+
filePlan: plan
|
|
8830
|
+
},
|
|
8763
8831
|
predicate: ({
|
|
8764
8832
|
filePlan
|
|
8765
8833
|
}) => filePlan
|
|
@@ -9220,7 +9288,7 @@ const executePlan = async (plan, {
|
|
|
9220
9288
|
const executionSpinner = !debugLogsEnabled && executionLogsEnabled && process.stdout.isTTY && // if there is an error during execution npm will mess up the output
|
|
9221
9289
|
// (happens when npm runs several command in a workspace)
|
|
9222
9290
|
// so we enable spinner only when !process.exitCode (no error so far)
|
|
9223
|
-
|
|
9291
|
+
process.exitCode !== 1;
|
|
9224
9292
|
const startMs = Date.now();
|
|
9225
9293
|
const report = {};
|
|
9226
9294
|
let rawOutput = "";
|
|
@@ -9234,15 +9302,18 @@ const executePlan = async (plan, {
|
|
|
9234
9302
|
const coverageTempDirectoryUrl = new URL(coverageTempDirectoryRelativeUrl, rootDirectoryUrl).href;
|
|
9235
9303
|
|
|
9236
9304
|
if (coverage) {
|
|
9237
|
-
const
|
|
9305
|
+
const associations = URL_META.resolveAssociations({
|
|
9238
9306
|
cover: coverageConfig
|
|
9239
9307
|
}, rootDirectoryUrl);
|
|
9240
9308
|
|
|
9241
9309
|
const urlShouldBeCovered = url => {
|
|
9242
|
-
|
|
9310
|
+
const {
|
|
9311
|
+
cover
|
|
9312
|
+
} = URL_META.applyAssociations({
|
|
9243
9313
|
url: new URL(url, rootDirectoryUrl).href,
|
|
9244
|
-
|
|
9245
|
-
})
|
|
9314
|
+
associations
|
|
9315
|
+
});
|
|
9316
|
+
return cover;
|
|
9246
9317
|
};
|
|
9247
9318
|
|
|
9248
9319
|
runtimeParams.urlShouldBeCovered = urlShouldBeCovered; // in case runned multiple times, we don't want to keep writing lot of files in this directory
|
|
@@ -9705,17 +9776,20 @@ const executeTestPlan = async ({
|
|
|
9705
9776
|
}
|
|
9706
9777
|
|
|
9707
9778
|
if (!coverageAndExecutionAllowed) {
|
|
9708
|
-
const
|
|
9779
|
+
const associationsForExecute = URL_META.resolveAssociations({
|
|
9709
9780
|
execute: testPlan
|
|
9710
9781
|
}, "file:///");
|
|
9711
|
-
const
|
|
9782
|
+
const associationsForCover = URL_META.resolveAssociations({
|
|
9712
9783
|
cover: coverageConfig
|
|
9713
9784
|
}, "file:///");
|
|
9714
|
-
const patternsMatchingCoverAndExecute = Object.keys(
|
|
9715
|
-
|
|
9785
|
+
const patternsMatchingCoverAndExecute = Object.keys(associationsForExecute.execute).filter(testPlanPattern => {
|
|
9786
|
+
const {
|
|
9787
|
+
cover
|
|
9788
|
+
} = URL_META.applyAssociations({
|
|
9716
9789
|
url: testPlanPattern,
|
|
9717
|
-
|
|
9718
|
-
})
|
|
9790
|
+
associations: associationsForCover
|
|
9791
|
+
});
|
|
9792
|
+
return cover;
|
|
9719
9793
|
});
|
|
9720
9794
|
|
|
9721
9795
|
if (patternsMatchingCoverAndExecute.length) {
|
|
@@ -11737,7 +11811,7 @@ const resyncRessourceHints = async ({
|
|
|
11737
11811
|
}
|
|
11738
11812
|
|
|
11739
11813
|
if (urlInfo.dependents.size === 0) {
|
|
11740
|
-
logger.
|
|
11814
|
+
logger.info(`remove ressource hint because "${href}" not used anymore`);
|
|
11741
11815
|
actions.push(() => {
|
|
11742
11816
|
removeHtmlNode(linkNode);
|
|
11743
11817
|
});
|
|
@@ -11833,6 +11907,7 @@ const build = async ({
|
|
|
11833
11907
|
},
|
|
11834
11908
|
plugins = [],
|
|
11835
11909
|
sourcemaps = false,
|
|
11910
|
+
sourcemapsSourcesContent,
|
|
11836
11911
|
urlAnalysis = {},
|
|
11837
11912
|
nodeEsmResolution,
|
|
11838
11913
|
fileSystemMagicResolution,
|
|
@@ -11915,6 +11990,7 @@ build ${entryPointKeys.length} entry points`);
|
|
|
11915
11990
|
urlGraph: rawGraph,
|
|
11916
11991
|
scenario: "build",
|
|
11917
11992
|
sourcemaps,
|
|
11993
|
+
sourcemapsSourcesContent,
|
|
11918
11994
|
runtimeCompat,
|
|
11919
11995
|
writeGeneratedFiles,
|
|
11920
11996
|
plugins: [...plugins, {
|
|
@@ -12115,6 +12191,8 @@ build ${entryPointKeys.length} entry points`);
|
|
|
12115
12191
|
type,
|
|
12116
12192
|
subtype: rawUrlInfo ? rawUrlInfo.subtype : undefined,
|
|
12117
12193
|
filename: rawUrlInfo ? rawUrlInfo.filename : undefined,
|
|
12194
|
+
originalUrl: rawUrlInfo ? rawUrlInfo.originalUrl : undefined,
|
|
12195
|
+
originalContent: rawUrlInfo ? rawUrlInfo.originalContent : undefined,
|
|
12118
12196
|
...bundlerGeneratedUrlInfo,
|
|
12119
12197
|
data: { ...(rawUrlInfo ? rawUrlInfo.data : {}),
|
|
12120
12198
|
...bundlerGeneratedUrlInfo.data,
|
|
@@ -12160,6 +12238,7 @@ build ${entryPointKeys.length} entry points`);
|
|
|
12160
12238
|
urlGraph: finalGraph,
|
|
12161
12239
|
scenario: "build",
|
|
12162
12240
|
sourcemaps,
|
|
12241
|
+
sourcemapsSourcesContent,
|
|
12163
12242
|
sourcemapsRelativeSources: !versioning,
|
|
12164
12243
|
runtimeCompat,
|
|
12165
12244
|
writeGeneratedFiles,
|
|
@@ -12315,12 +12394,12 @@ build ${entryPointKeys.length} entry points`);
|
|
|
12315
12394
|
urlInfo: rawUrlInfo,
|
|
12316
12395
|
parentUrlInfo
|
|
12317
12396
|
});
|
|
12397
|
+
rawUrls[buildUrl] = rawUrlInfo.url;
|
|
12318
12398
|
|
|
12319
12399
|
if (buildUrl.includes("?")) {
|
|
12320
12400
|
rawUrls[asUrlWithoutSearch(buildUrl)] = rawUrlInfo.url;
|
|
12321
12401
|
}
|
|
12322
12402
|
|
|
12323
|
-
rawUrls[buildUrl] = rawUrlInfo.url;
|
|
12324
12403
|
return buildUrl;
|
|
12325
12404
|
}
|
|
12326
12405
|
|
|
@@ -12491,6 +12570,7 @@ ${Object.keys(finalGraph.urlInfos).join("\n")}`);
|
|
|
12491
12570
|
baseUrl,
|
|
12492
12571
|
postBuildEntryUrls,
|
|
12493
12572
|
sourcemaps,
|
|
12573
|
+
sourcemapsSourcesContent,
|
|
12494
12574
|
runtimeCompat,
|
|
12495
12575
|
writeGeneratedFiles,
|
|
12496
12576
|
rawGraph,
|
|
@@ -12718,6 +12798,7 @@ const applyUrlVersioning = async ({
|
|
|
12718
12798
|
baseUrl,
|
|
12719
12799
|
postBuildEntryUrls,
|
|
12720
12800
|
sourcemaps,
|
|
12801
|
+
sourcemapsSourcesContent,
|
|
12721
12802
|
runtimeCompat,
|
|
12722
12803
|
writeGeneratedFiles,
|
|
12723
12804
|
rawGraph,
|
|
@@ -12820,6 +12901,7 @@ const applyUrlVersioning = async ({
|
|
|
12820
12901
|
urlGraph: finalGraph,
|
|
12821
12902
|
scenario: "build",
|
|
12822
12903
|
sourcemaps,
|
|
12904
|
+
sourcemapsSourcesContent,
|
|
12823
12905
|
sourcemapsRelativeSources: true,
|
|
12824
12906
|
runtimeCompat,
|
|
12825
12907
|
writeGeneratedFiles,
|
|
@@ -12858,6 +12940,14 @@ const applyUrlVersioning = async ({
|
|
|
12858
12940
|
return url;
|
|
12859
12941
|
},
|
|
12860
12942
|
formatUrl: reference => {
|
|
12943
|
+
if (!reference.shouldHandle) {
|
|
12944
|
+
if (reference.generatedUrl.startsWith("ignore:")) {
|
|
12945
|
+
return reference.generatedUrl.slice("ignore:".length);
|
|
12946
|
+
}
|
|
12947
|
+
|
|
12948
|
+
return null;
|
|
12949
|
+
}
|
|
12950
|
+
|
|
12861
12951
|
if (reference.isInline || reference.url.startsWith("data:")) {
|
|
12862
12952
|
return null;
|
|
12863
12953
|
}
|