@jsenv/core 27.0.0-alpha.62 → 27.0.0-alpha.65
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/html/explorer.html +557 -0
- package/dist/js/controllable_file.mjs +227 -0
- package/dist/{event_source_client.js → js/event_source_client.js} +19 -244
- package/dist/js/global_this.js +32 -0
- package/dist/js/html_supervisor_installer.js +522 -0
- package/dist/js/html_supervisor_setup.js +79 -0
- package/dist/{import_meta_hot.js → js/import_meta_hot.js} +1 -3
- package/dist/js/inline_content.js +8 -0
- package/dist/js/new_stylesheet.js +409 -0
- package/dist/js/regenerator_runtime.js +721 -0
- package/dist/js/s.js +429 -0
- package/dist/main.js +13362 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/AsyncGenerator/AsyncGenerator.js +95 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/AwaitValue/AwaitValue.js +3 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/applyDecoratorDescriptor/applyDecoratorDescriptor.js +29 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/arrayLikeToArray/arrayLikeToArray.js +9 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/arrayWithHoles/arrayWithHoles.js +4 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/arrayWithoutHoles/arrayWithoutHoles.js +5 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/assertThisInitialized/assertThisInitialized.js +8 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/asyncGeneratorDelegate/asyncGeneratorDelegate.js +52 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/asyncIterator/asyncIterator.js +78 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/asyncToGenerator/asyncToGenerator.js +39 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/awaitAsyncGenerator/awaitAsyncGenerator.js +4 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/classApplyDescriptorDestructureSet/classApplyDescriptorDestructureSet.js +24 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/classApplyDescriptorGet/classApplyDescriptorGet.js +7 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/classApplyDescriptorSet/classApplyDescriptorSet.js +14 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/classCallCheck/classCallCheck.js +5 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/classCheckPrivateStaticAccess/classCheckPrivateStaticAccess.js +5 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/classCheckPrivateStaticFieldDescriptor/classCheckPrivateStaticFieldDescriptor.js +6 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/classExtractFieldDescriptor/classExtractFieldDescriptor.js +8 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/classNameTDZError/classNameTDZError.js +4 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/classPrivateFieldDestructureSet/classPrivateFieldDestructureSet.js +6 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/classPrivateFieldGet/classPrivateFieldGet.js +6 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/classPrivateFieldLooseBase/classPrivateFieldLooseBase.js +7 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/classPrivateFieldLooseKey/classPrivateFieldLooseKey.js +5 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/classPrivateFieldSet/classPrivateFieldSet.js +7 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/classPrivateMethodGet/classPrivateMethodGet.js +7 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/classPrivateMethodSet/classPrivateMethodSet.js +3 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/classStaticPrivateFieldSpecGet/classStaticPrivateFieldSpecGet.js +8 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/classStaticPrivateFieldSpecSet/classStaticPrivateFieldSpecSet.js +9 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/classStaticPrivateMethodGet/classStaticPrivateMethodGet.js +5 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/classStaticPrivateMethodSet/classStaticPrivateMethodSet.js +3 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/construct/construct.js +15 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/createClass/createClass.js +18 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/createForOfIteratorHelper/createForOfIteratorHelper.js +63 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/createForOfIteratorHelperLoose/createForOfIteratorHelperLoose.js +22 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/createRawReactElement/createRawReactElement.js +50 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/createSuper/createSuper.js +22 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/decorate/decorate.js +622 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/defaults/defaults.js +14 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/defineEnumerableProperties/defineEnumerableProperties.js +26 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/defineProperty/defineProperty.js +19 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/extends/extends.js +16 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/get/get.js +21 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/getPrototypeOf/getPrototypeOf.js +2 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/inherits/inherits.js +21 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/inheritsLoose/inheritsLoose.js +6 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/initializerDefineProperty/initializerDefineProperty.js +10 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/initializerWarningHelper/initializerWarningHelper.js +3 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/instanceof/instanceof.js +7 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/interopRequireDefault/interopRequireDefault.js +5 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/interopRequireWildcard/interopRequireWildcard.js +49 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/isNativeFunction/isNativeFunction.js +4 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/isNativeReflectConstruct/isNativeReflectConstruct.js +21 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/iterableToArray/iterableToArray.js +3 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/iterableToArrayLimit/iterableToArrayLimit.js +38 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/iterableToArrayLimitLoose/iterableToArrayLimitLoose.js +13 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/jsx/jsx.js +49 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/maybeArrayLike/maybeArrayLike.js +10 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/newArrowCheck/newArrowCheck.js +5 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/nonIterableRest/nonIterableRest.js +3 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/nonIterableSpread/nonIterableSpread.js +3 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/objectDestructuringEmpty/objectDestructuringEmpty.js +3 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/objectSpread/objectSpread.js +22 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/objectSpread2/objectSpread2.js +41 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/objectWithoutProperties/objectWithoutProperties.js +20 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/objectWithoutPropertiesLoose/objectWithoutPropertiesLoose.js +15 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/possibleConstructorReturn/possibleConstructorReturn.js +10 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/readOnlyError/readOnlyError.js +4 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/readme.md +8 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/set/set.js +51 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/setPrototypeOf/setPrototypeOf.js +5 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/skipFirstGeneratorNext/skipFirstGeneratorNext.js +8 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/slicedToArray/slicedToArray.js +5 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/slicedToArrayLoose/slicedToArrayLoose.js +7 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/superPropBase/superPropBase.js +10 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/taggedTemplateLiteral/taggedTemplateLiteral.js +11 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/taggedTemplateLiteralLoose/taggedTemplateLiteralLoose.js +8 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/tdz/tdz.js +4 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/temporalRef/temporalRef.js +5 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/temporalUndefined/temporalUndefined.js +3 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/toArray/toArray.js +5 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/toConsumableArray/toConsumableArray.js +5 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/toPrimitive/toPrimitive.js +14 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/toPropertyKey/toPropertyKey.js +5 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/typeof/typeof.js +7 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/unsupportedIterableToArray/unsupportedIterableToArray.js +10 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/wrapAsyncGenerator/wrapAsyncGenerator.js +7 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/wrapNativeSuper/wrapNativeSuper.js +35 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/wrapRegExp/wrapRegExp.js +67 -0
- package/dist/node_modules/@jsenv/babel-plugins/src/babel_helpers/writeOnlyError/writeOnlyError.js +4 -0
- package/dist/other/jsenv.png +0 -0
- package/main.js +1 -0
- package/package.json +18 -14
- package/src/build/build.js +169 -69
- package/src/build/build_urls_generator.js +18 -2
- package/src/build/inject_global_version_mappings.js +18 -5
- package/src/build/inject_service_worker_urls.js +1 -1
- package/src/build/resync_ressource_hints.js +56 -9
- package/src/build/start_build_server.js +41 -30
- package/src/dev/plugins/explorer/client/explorer.html +1 -1
- package/src/dev/start_dev_server.js +21 -5
- package/src/execute/execute.js +3 -0
- package/src/execute/runtimes/browsers/from_playwright.js +10 -0
- package/src/execute/runtimes/node/node_process.js +8 -0
- package/src/omega/errors.js +10 -7
- package/src/omega/kitchen.js +251 -340
- package/src/omega/server/file_service.js +34 -17
- package/src/omega/url_graph/url_graph_load.js +10 -17
- package/src/omega/url_graph/url_graph_report.js +2 -2
- package/src/omega/url_graph/url_info_transformations.js +1 -4
- package/src/omega/url_graph.js +7 -3
- package/src/omega/url_specifier_encoding.js +59 -0
- package/src/plugins/autoreload/dev_sse/jsenv_plugin_dev_sse_client.js +5 -10
- package/src/plugins/autoreload/jsenv_plugin_autoreload.js +1 -3
- package/src/plugins/bundling/js_module/bundle_js_module.js +66 -24
- package/src/plugins/file_urls/jsenv_plugin_file_urls.js +171 -53
- package/src/plugins/html_supervisor/client/html_supervisor_installer.js +1 -1
- package/src/plugins/html_supervisor/jsenv_plugin_html_supervisor.js +9 -13
- package/src/plugins/http_urls/jsenv_plugin_http_urls.js +6 -6
- package/src/plugins/import_meta_hot/jsenv_plugin_import_meta_hot.js +5 -10
- package/src/plugins/importmap/jsenv_plugin_importmap.js +2 -4
- package/src/plugins/inject_globals/jsenv_plugin_inject_globals.js +51 -42
- package/src/plugins/inline/jsenv_plugin_data_urls.js +1 -4
- package/src/plugins/inline/jsenv_plugin_html_inline_content.js +3 -5
- package/src/plugins/inline/jsenv_plugin_inline_query_param.js +1 -4
- package/src/plugins/inline/jsenv_plugin_js_inline_content.js +1 -4
- package/src/plugins/node_esm_resolution/jsenv_plugin_node_esm_resolution.js +16 -2
- package/src/plugins/node_runtime/jsenv_plugin_node_runtime.js +12 -0
- package/src/plugins/plugin_controller.js +17 -3
- package/src/plugins/plugins.js +15 -15
- package/src/plugins/transpilation/as_js_classic/client/s.js +362 -807
- package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic.js +20 -10
- package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic_html.js +302 -0
- package/src/plugins/transpilation/as_js_classic/{jsenv_plugin_workers_type_module_as_classic.js → jsenv_plugin_as_js_classic_workers.js} +2 -2
- package/src/plugins/transpilation/babel/jsenv_plugin_babel.js +5 -2
- package/src/plugins/transpilation/import_assertions/jsenv_plugin_import_assertions.js +1 -2
- package/src/plugins/transpilation/jsenv_plugin_transpilation.js +2 -0
- package/src/plugins/url_analysis/html/html_urls.js +3 -0
- package/src/plugins/url_analysis/js/js_urls.js +2 -1
- package/src/plugins/url_analysis/jsenv_plugin_url_analysis.js +87 -1
- package/src/plugins/url_analysis/webmanifest/webmanifest_urls.js +3 -0
- package/src/plugins/url_resolution/jsenv_plugin_url_resolution.js +0 -3
- package/src/test/execute_plan.js +34 -13
- package/src/test/execute_test_plan.js +2 -0
- package/src/test/logs_file_execution.js +47 -38
- package/dist/event_source_client.js.map +0 -188
- package/dist/html_supervisor_installer.js +0 -1236
- package/dist/html_supervisor_installer.js.map +0 -337
- package/dist/html_supervisor_setup.js +0 -95
- package/dist/html_supervisor_setup.js.map +0 -57
- package/dist/import_meta_hot.js.map +0 -42
- package/src/jsenv_root_directory_url.js +0 -1
- package/src/omega/compat/default_runtime_compat.js +0 -11
- package/src/plugins/filesystem_magic/jsenv_plugin_filesystem_magic.js +0 -61
- package/src/plugins/transpilation/as_js_classic/client/s.js.md +0 -1
- package/src/plugins/transpilation/as_js_classic/jsenv_plugin_script_type_module_as_classic.js +0 -270
- package/src/plugins/transpilation/babel/new_stylesheet/client/.eslintrc.cjs +0 -24
- package/src/plugins/transpilation/fetch_original_url_info.js +0 -30
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"file": "html_supervisor_setup.js",
|
|
4
|
-
"sources": [
|
|
5
|
-
"../src/plugins/html_supervisor/client/html_supervisor_setup.js"
|
|
6
|
-
],
|
|
7
|
-
"sourcesContent": [
|
|
8
|
-
"window.__html_supervisor__ = {\n // \"html_supervisor_installer.js\" will implement\n // - \"addScriptToExecute\"\n // - \"superviseScriptTypeModule\"\n // - \"collectScriptResults\"\n // and take all executions in \"scriptsToExecute\" and implement their supervision\n scriptsToExecute: [],\n addScriptToExecute: (scriptToExecute) => {\n window.__html_supervisor__.scriptsToExecute.push(scriptToExecute)\n },\n superviseScript: ({ src, isInline, crossorigin, integrity }) => {\n window.__html_supervisor__.addScriptToExecute({\n src,\n type: \"js_classic\",\n isInline,\n currentScript: document.currentScript,\n execute: () => {\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\")\n if (crossorigin) {\n script.crossorigin = crossorigin\n }\n if (integrity) {\n script.integrity = integrity\n }\n script.src = src\n const scriptUrl = new URL(src, window.location).href\n let lastWindowErrorUrl\n let lastWindowError\n const windowErrorCallback = (e) => {\n lastWindowErrorUrl = e.filename\n lastWindowError = e.error\n }\n const cleanup = () => {\n document.body.removeChild(script)\n window.removeEventListener(\"error\", windowErrorCallback)\n }\n window.addEventListener(\"error\", windowErrorCallback)\n script.addEventListener(\"error\", () => {\n cleanup()\n reject(src)\n })\n script.addEventListener(\"load\", () => {\n cleanup()\n if (lastWindowErrorUrl === scriptUrl) {\n reject(lastWindowError)\n } else {\n resolve()\n }\n })\n document.body.appendChild(script)\n })\n },\n })\n },\n superviseScriptTypeModule: () => {\n throw new Error(\"htmlSupervisor not installed\")\n },\n getScriptExecutionResults: () => {\n // wait for page to load before collecting script execution results\n const htmlReadyPromise = new Promise((resolve) => {\n if (document.readyState === \"complete\") {\n resolve()\n return\n }\n const loadCallback = () => {\n window.removeEventListener(\"load\", loadCallback)\n resolve()\n }\n window.addEventListener(\"load\", loadCallback)\n })\n return htmlReadyPromise.then(() => {\n return window.__html_supervisor__.collectScriptResults()\n })\n },\n collectScriptResults: () => {\n throw new Error(\"htmlSupervisor not installed\")\n },\n}\n"
|
|
9
|
-
],
|
|
10
|
-
"names": [
|
|
11
|
-
"window",
|
|
12
|
-
"__html_supervisor__",
|
|
13
|
-
"scriptsToExecute",
|
|
14
|
-
"addScriptToExecute",
|
|
15
|
-
"scriptToExecute",
|
|
16
|
-
"push",
|
|
17
|
-
"superviseScript",
|
|
18
|
-
"src",
|
|
19
|
-
"isInline",
|
|
20
|
-
"crossorigin",
|
|
21
|
-
"integrity",
|
|
22
|
-
"type",
|
|
23
|
-
"currentScript",
|
|
24
|
-
"document",
|
|
25
|
-
"execute",
|
|
26
|
-
"Promise",
|
|
27
|
-
"resolve",
|
|
28
|
-
"reject",
|
|
29
|
-
"script",
|
|
30
|
-
"createElement",
|
|
31
|
-
"scriptUrl",
|
|
32
|
-
"URL",
|
|
33
|
-
"location",
|
|
34
|
-
"href",
|
|
35
|
-
"lastWindowErrorUrl",
|
|
36
|
-
"lastWindowError",
|
|
37
|
-
"windowErrorCallback",
|
|
38
|
-
"e",
|
|
39
|
-
"filename",
|
|
40
|
-
"error",
|
|
41
|
-
"cleanup",
|
|
42
|
-
"body",
|
|
43
|
-
"removeChild",
|
|
44
|
-
"removeEventListener",
|
|
45
|
-
"addEventListener",
|
|
46
|
-
"appendChild",
|
|
47
|
-
"superviseScriptTypeModule",
|
|
48
|
-
"Error",
|
|
49
|
-
"getScriptExecutionResults",
|
|
50
|
-
"htmlReadyPromise",
|
|
51
|
-
"readyState",
|
|
52
|
-
"loadCallback",
|
|
53
|
-
"then",
|
|
54
|
-
"collectScriptResults"
|
|
55
|
-
],
|
|
56
|
-
"mappings": "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"
|
|
57
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"file": "import_meta_hot.js",
|
|
4
|
-
"sources": [
|
|
5
|
-
"../src/plugins/import_meta_hot/client/import_meta_hot.js"
|
|
6
|
-
],
|
|
7
|
-
"sourcesContent": [
|
|
8
|
-
"/*\n * https://vitejs.dev/guide/api-hmr.html#hot-accept-deps-cb\n * https://modern-web.dev/docs/dev-server/plugins/hmr/\n */\n\nexport const urlHotMetas = {}\n\nexport const createImportMetaHot = (importMetaUrl) => {\n const data = {}\n const url = asUrlWithoutHmrQuery(importMetaUrl)\n\n return {\n data,\n accept: (firstArg, secondArg) => {\n if (!firstArg) {\n addUrlMeta(url, {\n dependencies: [url],\n acceptCallback: () => {},\n })\n return\n }\n if (typeof firstArg === \"function\") {\n addUrlMeta(url, {\n dependencies: [url],\n acceptCallback: firstArg,\n })\n return\n }\n if (typeof firstArg === \"string\") {\n addUrlMeta(url, {\n dependencies: [firstArg],\n acceptCallback: secondArg,\n })\n return\n }\n if (Array.isArray(firstArg)) {\n addUrlMeta(url, {\n dependencies: firstArg,\n acceptCallback: secondArg,\n })\n return\n }\n throw new Error(\n `invalid call to import.meta.hot.accept(), received ${firstArg}`,\n )\n },\n dispose: (callback) => {\n addUrlMeta(url, {\n disposeCallback: () => {\n return callback(data)\n },\n })\n },\n decline: () => {\n addUrlMeta(url, {\n declined: true,\n })\n },\n invalidate: () => {\n addUrlMeta(url, {\n invalidated: true,\n })\n },\n }\n}\n\nconst addUrlMeta = (url, meta) => {\n urlHotMetas[url] = {\n ...urlHotMetas[url],\n ...meta,\n }\n}\n\nconst asUrlWithoutHmrQuery = (url) => {\n const urlObject = new URL(url)\n if (urlObject.searchParams.has(\"hmr\")) {\n urlObject.searchParams.delete(\"hmr\")\n urlObject.searchParams.delete(\"v\")\n return urlObject.href\n }\n return url\n}\n"
|
|
9
|
-
],
|
|
10
|
-
"names": [
|
|
11
|
-
"urlHotMetas",
|
|
12
|
-
"createImportMetaHot",
|
|
13
|
-
"importMetaUrl",
|
|
14
|
-
"data",
|
|
15
|
-
"url",
|
|
16
|
-
"asUrlWithoutHmrQuery",
|
|
17
|
-
"accept",
|
|
18
|
-
"firstArg",
|
|
19
|
-
"secondArg",
|
|
20
|
-
"addUrlMeta",
|
|
21
|
-
"dependencies",
|
|
22
|
-
"acceptCallback",
|
|
23
|
-
"Array",
|
|
24
|
-
"isArray",
|
|
25
|
-
"Error",
|
|
26
|
-
"dispose",
|
|
27
|
-
"callback",
|
|
28
|
-
"disposeCallback",
|
|
29
|
-
"decline",
|
|
30
|
-
"declined",
|
|
31
|
-
"invalidate",
|
|
32
|
-
"invalidated",
|
|
33
|
-
"meta",
|
|
34
|
-
"urlObject",
|
|
35
|
-
"URL",
|
|
36
|
-
"searchParams",
|
|
37
|
-
"has",
|
|
38
|
-
"delete",
|
|
39
|
-
"href"
|
|
40
|
-
],
|
|
41
|
-
"mappings": "AAAA;AACA;AACA;AACA;AAEO,MAAMA,WAAW,GAAG,GAApB;AAEMC,MAAAA,mBAAmB,GAAIC,aAAD,IAAmB;EACpD,MAAMC,IAAI,GAAG,EAAb,CAAA;AACA,EAAA,MAAMC,GAAG,GAAGC,oBAAoB,CAACH,aAAD,CAAhC,CAAA;EAEA,OAAO;IACLC,IADK;AAELG,IAAAA,MAAM,EAAE,CAACC,QAAD,EAAWC,SAAX,KAAyB;MAC/B,IAAI,CAACD,QAAL,EAAe;QACbE,UAAU,CAACL,GAAD,EAAM;UACdM,YAAY,EAAE,CAACN,GAAD,CADA;UAEdO,cAAc,EAAE,MAAM,EAAE;AAFV,SAAN,CAAV,CAAA;AAIA,QAAA,OAAA;AACD,OAAA;;AACD,MAAA,IAAI,OAAOJ,QAAP,KAAoB,UAAxB,EAAoC;QAClCE,UAAU,CAACL,GAAD,EAAM;UACdM,YAAY,EAAE,CAACN,GAAD,CADA;AAEdO,UAAAA,cAAc,EAAEJ,QAAAA;AAFF,SAAN,CAAV,CAAA;AAIA,QAAA,OAAA;AACD,OAAA;;AACD,MAAA,IAAI,OAAOA,QAAP,KAAoB,QAAxB,EAAkC;QAChCE,UAAU,CAACL,GAAD,EAAM;UACdM,YAAY,EAAE,CAACH,QAAD,CADA;AAEdI,UAAAA,cAAc,EAAEH,SAAAA;AAFF,SAAN,CAAV,CAAA;AAIA,QAAA,OAAA;AACD,OAAA;;AACD,MAAA,IAAII,KAAK,CAACC,OAAN,CAAcN,QAAd,CAAJ,EAA6B;QAC3BE,UAAU,CAACL,GAAD,EAAM;AACdM,UAAAA,YAAY,EAAEH,QADA;AAEdI,UAAAA,cAAc,EAAEH,SAAAA;AAFF,SAAN,CAAV,CAAA;AAIA,QAAA,OAAA;AACD,OAAA;;AACD,MAAA,MAAM,IAAIM,KAAJ,CACkDP,qDAAAA,CAAAA,MAAAA,CAAAA,QADlD,CAAN,CAAA,CAAA;KA/BG;IAmCLQ,OAAO,EAAGC,QAAD,IAAc;MACrBP,UAAU,CAACL,GAAD,EAAM;AACda,QAAAA,eAAe,EAAE,MAAM;UACrB,OAAOD,QAAQ,CAACb,IAAD,CAAf,CAAA;AACD,SAAA;AAHa,OAAN,CAAV,CAAA;KApCG;AA0CLe,IAAAA,OAAO,EAAE,MAAM;MACbT,UAAU,CAACL,GAAD,EAAM;AACde,QAAAA,QAAQ,EAAE,IAAA;AADI,OAAN,CAAV,CAAA;KA3CG;AA+CLC,IAAAA,UAAU,EAAE,MAAM;MAChBX,UAAU,CAACL,GAAD,EAAM;AACdiB,QAAAA,WAAW,EAAE,IAAA;AADC,OAAN,CAAV,CAAA;AAGD,KAAA;GAnDH,CAAA;AAqDD,EAzDM;;AA2DP,MAAMZ,UAAU,GAAG,CAACL,GAAD,EAAMkB,IAAN,KAAe;EAChCtB,WAAW,CAACI,GAAD,CAAX,GAAmB,EACjB,GAAGJ,WAAW,CAACI,GAAD,CADG;IAEjB,GAAGkB,IAAAA;GAFL,CAAA;AAID,CALD,CAAA;;AAOA,MAAMjB,oBAAoB,GAAID,GAAD,IAAS;AACpC,EAAA,MAAMmB,SAAS,GAAG,IAAIC,GAAJ,CAAQpB,GAAR,CAAlB,CAAA;;EACA,IAAImB,SAAS,CAACE,YAAV,CAAuBC,GAAvB,CAA2B,KAA3B,CAAJ,EAAuC;AACrCH,IAAAA,SAAS,CAACE,YAAV,CAAuBE,MAAvB,CAA8B,KAA9B,CAAA,CAAA;AACAJ,IAAAA,SAAS,CAACE,YAAV,CAAuBE,MAAvB,CAA8B,GAA9B,CAAA,CAAA;IACA,OAAOJ,SAAS,CAACK,IAAjB,CAAA;AACD,GAAA;;AACD,EAAA,OAAOxB,GAAP,CAAA;AACD,CARD;;;;"
|
|
42
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const jsenvRootDirectoryUrl = new URL("../", import.meta.url).href
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// https://github.com/vitejs/vite/blob/main/packages/vite/src/node/plugins/resolve.ts
|
|
2
|
-
|
|
3
|
-
import { realpathSync } from "node:fs"
|
|
4
|
-
import { pathToFileURL } from "node:url"
|
|
5
|
-
import { urlToExtension } from "@jsenv/filesystem"
|
|
6
|
-
import { applyFileSystemMagicResolution } from "@jsenv/node-esm-resolution"
|
|
7
|
-
|
|
8
|
-
export const jsenvPluginFileSystemMagic = ({
|
|
9
|
-
magicExtensions = ["inherit", ".js"],
|
|
10
|
-
magicDirectoryIndex = true,
|
|
11
|
-
preservesSymlink = true,
|
|
12
|
-
} = {}) => {
|
|
13
|
-
return {
|
|
14
|
-
name: "jsenv:filesystem_magic",
|
|
15
|
-
appliesDuring: "*",
|
|
16
|
-
redirectUrl: (reference) => {
|
|
17
|
-
// http, https, data, about, etc
|
|
18
|
-
if (!reference.url.startsWith("file:")) {
|
|
19
|
-
return null
|
|
20
|
-
}
|
|
21
|
-
const urlObject = new URL(reference.url)
|
|
22
|
-
const { search, hash } = urlObject
|
|
23
|
-
urlObject.search = ""
|
|
24
|
-
urlObject.hash = ""
|
|
25
|
-
const filesystemResolution = applyFileSystemMagicResolution(
|
|
26
|
-
urlObject.href,
|
|
27
|
-
{
|
|
28
|
-
magicDirectoryIndex,
|
|
29
|
-
magicExtensions: getExtensionsToTry(
|
|
30
|
-
magicExtensions,
|
|
31
|
-
reference.parentUrl,
|
|
32
|
-
),
|
|
33
|
-
},
|
|
34
|
-
)
|
|
35
|
-
if (!filesystemResolution.found) {
|
|
36
|
-
return null
|
|
37
|
-
}
|
|
38
|
-
const fileUrlRaw = filesystemResolution.url
|
|
39
|
-
const fileUrl = `${fileUrlRaw}${search}${hash}`
|
|
40
|
-
if (preservesSymlink) {
|
|
41
|
-
return fileUrl
|
|
42
|
-
}
|
|
43
|
-
const realPath = realpathSync(urlObject)
|
|
44
|
-
const realFileUrl = `${pathToFileURL(realPath)}${search}${hash}`
|
|
45
|
-
return realFileUrl
|
|
46
|
-
},
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const getExtensionsToTry = (magicExtensions, importer) => {
|
|
51
|
-
const extensionsSet = new Set()
|
|
52
|
-
magicExtensions.forEach((magicExtension) => {
|
|
53
|
-
if (magicExtension === "inherit") {
|
|
54
|
-
const importerExtension = urlToExtension(importer)
|
|
55
|
-
extensionsSet.add(importerExtension)
|
|
56
|
-
} else {
|
|
57
|
-
extensionsSet.add(magicExtension)
|
|
58
|
-
}
|
|
59
|
-
})
|
|
60
|
-
return Array.from(extensionsSet.values())
|
|
61
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
s.js exists to ease jsenv ability to find the file.
|
package/src/plugins/transpilation/as_js_classic/jsenv_plugin_script_type_module_as_classic.js
DELETED
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getHtmlNodeAttributeByName,
|
|
3
|
-
getHtmlNodeTextNode,
|
|
4
|
-
parseHtmlString,
|
|
5
|
-
removeHtmlNodeAttributeByName,
|
|
6
|
-
assignHtmlNodeAttributes,
|
|
7
|
-
stringifyHtmlAst,
|
|
8
|
-
visitHtmlAst,
|
|
9
|
-
htmlNodePosition,
|
|
10
|
-
setHtmlNodeGeneratedText,
|
|
11
|
-
injectScriptAsEarlyAsPossible,
|
|
12
|
-
createHtmlNode,
|
|
13
|
-
} from "@jsenv/utils/html_ast/html_ast.js"
|
|
14
|
-
import { generateInlineContentUrl } from "@jsenv/utils/urls/inline_content_url_generator.js"
|
|
15
|
-
import { injectQueryParamsIntoSpecifier } from "@jsenv/utils/urls/url_utils.js"
|
|
16
|
-
|
|
17
|
-
export const jsenvPluginScriptTypeModuleAsClassic = ({
|
|
18
|
-
systemJsInjection,
|
|
19
|
-
systemJsClientFileUrl,
|
|
20
|
-
generateJsClassicFilename,
|
|
21
|
-
}) => {
|
|
22
|
-
return {
|
|
23
|
-
name: "jsenv:script_type_module_as_classic",
|
|
24
|
-
appliesDuring: "*",
|
|
25
|
-
transformUrlContent: {
|
|
26
|
-
html: async (urlInfo, context) => {
|
|
27
|
-
if (
|
|
28
|
-
context.isSupportedOnCurrentClients("script_type_module") &&
|
|
29
|
-
context.isSupportedOnCurrentClients("import_dynamic")
|
|
30
|
-
) {
|
|
31
|
-
return null
|
|
32
|
-
}
|
|
33
|
-
const htmlAst = parseHtmlString(urlInfo.content)
|
|
34
|
-
const preloadAsScriptNodes = []
|
|
35
|
-
const modulePreloadNodes = []
|
|
36
|
-
const moduleScriptNodes = []
|
|
37
|
-
const classicScriptNodes = []
|
|
38
|
-
const visitLinkNodes = (node) => {
|
|
39
|
-
if (node.nodeName !== "link") {
|
|
40
|
-
return
|
|
41
|
-
}
|
|
42
|
-
const relAttribute = getHtmlNodeAttributeByName(node, "rel")
|
|
43
|
-
const rel = relAttribute ? relAttribute.value : undefined
|
|
44
|
-
if (rel === "modulepreload") {
|
|
45
|
-
modulePreloadNodes.push(node)
|
|
46
|
-
return
|
|
47
|
-
}
|
|
48
|
-
if (rel === "preload") {
|
|
49
|
-
const asAttribute = getHtmlNodeAttributeByName(node, "as")
|
|
50
|
-
const as = asAttribute ? asAttribute.value : undefined
|
|
51
|
-
if (as === "script") {
|
|
52
|
-
preloadAsScriptNodes.push(node)
|
|
53
|
-
}
|
|
54
|
-
return
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
const visitScriptNodes = (node) => {
|
|
58
|
-
if (node.nodeName !== "script") {
|
|
59
|
-
return
|
|
60
|
-
}
|
|
61
|
-
const typeAttribute = getHtmlNodeAttributeByName(node, "type")
|
|
62
|
-
const type = typeAttribute ? typeAttribute.value : undefined
|
|
63
|
-
if (type === "module") {
|
|
64
|
-
moduleScriptNodes.push(node)
|
|
65
|
-
return
|
|
66
|
-
}
|
|
67
|
-
if (type === undefined || type === "text/javascript") {
|
|
68
|
-
classicScriptNodes.push(node)
|
|
69
|
-
return
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
visitHtmlAst(htmlAst, (node) => {
|
|
73
|
-
visitLinkNodes(node)
|
|
74
|
-
visitScriptNodes(node)
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
const classicScriptUrls = []
|
|
78
|
-
const moduleScriptUrls = []
|
|
79
|
-
classicScriptNodes.forEach((classicScriptNode) => {
|
|
80
|
-
const srcAttribute = getHtmlNodeAttributeByName(
|
|
81
|
-
classicScriptNode,
|
|
82
|
-
"src",
|
|
83
|
-
)
|
|
84
|
-
if (srcAttribute) {
|
|
85
|
-
const url = new URL(srcAttribute.value, urlInfo.url).href
|
|
86
|
-
classicScriptUrls.push(url)
|
|
87
|
-
}
|
|
88
|
-
})
|
|
89
|
-
moduleScriptNodes.forEach((moduleScriptNode) => {
|
|
90
|
-
const srcAttribute = getHtmlNodeAttributeByName(
|
|
91
|
-
moduleScriptNode,
|
|
92
|
-
"src",
|
|
93
|
-
)
|
|
94
|
-
if (srcAttribute) {
|
|
95
|
-
const url = new URL(srcAttribute.value, urlInfo.url).href
|
|
96
|
-
moduleScriptUrls.push(url)
|
|
97
|
-
}
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
const jsModuleUrls = []
|
|
101
|
-
const getReferenceAsJsClassic = async (
|
|
102
|
-
reference,
|
|
103
|
-
{
|
|
104
|
-
// we don't cook ressource hints
|
|
105
|
-
// because they might refer to ressource that will be modified during build
|
|
106
|
-
// It also means something else HAVE to reference that url in order to cook it
|
|
107
|
-
// so that the preload is deleted by "resync_ressource_hints.js" otherwise
|
|
108
|
-
cookIt = false,
|
|
109
|
-
} = {},
|
|
110
|
-
) => {
|
|
111
|
-
const [newReference, newUrlInfo] = context.referenceUtils.update(
|
|
112
|
-
reference,
|
|
113
|
-
{
|
|
114
|
-
expectedType: "js_classic",
|
|
115
|
-
specifier: injectQueryParamsIntoSpecifier(reference.specifier, {
|
|
116
|
-
as_js_classic: "",
|
|
117
|
-
}),
|
|
118
|
-
filename: generateJsClassicFilename(reference.url),
|
|
119
|
-
},
|
|
120
|
-
)
|
|
121
|
-
const jsModuleUrl = newUrlInfo.url
|
|
122
|
-
if (!jsModuleUrls.includes(jsModuleUrl)) {
|
|
123
|
-
jsModuleUrls.push(newUrlInfo.url)
|
|
124
|
-
}
|
|
125
|
-
if (cookIt) {
|
|
126
|
-
// during dev it means js modules will be cooked before server sends the HTML
|
|
127
|
-
// it's ok because:
|
|
128
|
-
// - during dev script_type_module are supported (dev use a recent browser)
|
|
129
|
-
// - even if browser is not supported it still works it's jus a bit slower
|
|
130
|
-
// because it needs to decide if systemjs will be injected or not
|
|
131
|
-
await context.cook({
|
|
132
|
-
reference: newReference,
|
|
133
|
-
urlInfo: newUrlInfo,
|
|
134
|
-
})
|
|
135
|
-
}
|
|
136
|
-
return [newReference, newUrlInfo]
|
|
137
|
-
}
|
|
138
|
-
const actions = []
|
|
139
|
-
preloadAsScriptNodes.forEach((preloadAsScriptNode) => {
|
|
140
|
-
const hrefAttribute = getHtmlNodeAttributeByName(
|
|
141
|
-
preloadAsScriptNode,
|
|
142
|
-
"href",
|
|
143
|
-
)
|
|
144
|
-
const href = hrefAttribute.value
|
|
145
|
-
const url = new URL(href, urlInfo.url).href
|
|
146
|
-
const expectedScriptType = moduleScriptUrls.includes(url)
|
|
147
|
-
? "module"
|
|
148
|
-
: "classic"
|
|
149
|
-
// keep in mind:
|
|
150
|
-
// when the url is not referenced by a <script type="module">
|
|
151
|
-
// we assume we want to preload "classic" but it might not be the case
|
|
152
|
-
// but it's unlikely to happen and people should use "modulepreload" in that case anyway
|
|
153
|
-
if (expectedScriptType === "module") {
|
|
154
|
-
actions.push(async () => {
|
|
155
|
-
const reference =
|
|
156
|
-
context.referenceUtils.findByGeneratedSpecifier(href)
|
|
157
|
-
const [newReference] = await getReferenceAsJsClassic(reference)
|
|
158
|
-
assignHtmlNodeAttributes(preloadAsScriptNode, {
|
|
159
|
-
href: newReference.generatedSpecifier,
|
|
160
|
-
})
|
|
161
|
-
removeHtmlNodeAttributeByName(preloadAsScriptNode, "crossorigin")
|
|
162
|
-
})
|
|
163
|
-
}
|
|
164
|
-
})
|
|
165
|
-
modulePreloadNodes.forEach((modulePreloadNode) => {
|
|
166
|
-
const hrefAttribute = getHtmlNodeAttributeByName(
|
|
167
|
-
modulePreloadNode,
|
|
168
|
-
"href",
|
|
169
|
-
)
|
|
170
|
-
const href = hrefAttribute.value
|
|
171
|
-
actions.push(async () => {
|
|
172
|
-
const reference =
|
|
173
|
-
context.referenceUtils.findByGeneratedSpecifier(href)
|
|
174
|
-
const [newReference] = await getReferenceAsJsClassic(reference)
|
|
175
|
-
assignHtmlNodeAttributes(modulePreloadNode, {
|
|
176
|
-
rel: "preload",
|
|
177
|
-
as: "script",
|
|
178
|
-
href: newReference.generatedSpecifier,
|
|
179
|
-
})
|
|
180
|
-
})
|
|
181
|
-
})
|
|
182
|
-
moduleScriptNodes.forEach((moduleScriptNode) => {
|
|
183
|
-
const srcAttribute = getHtmlNodeAttributeByName(
|
|
184
|
-
moduleScriptNode,
|
|
185
|
-
"src",
|
|
186
|
-
)
|
|
187
|
-
if (srcAttribute) {
|
|
188
|
-
actions.push(async () => {
|
|
189
|
-
const specifier = srcAttribute.value
|
|
190
|
-
const reference =
|
|
191
|
-
context.referenceUtils.findByGeneratedSpecifier(specifier)
|
|
192
|
-
const [newReference] = await getReferenceAsJsClassic(reference, {
|
|
193
|
-
cookIt: true,
|
|
194
|
-
})
|
|
195
|
-
removeHtmlNodeAttributeByName(moduleScriptNode, "type")
|
|
196
|
-
srcAttribute.value = newReference.generatedSpecifier
|
|
197
|
-
})
|
|
198
|
-
return
|
|
199
|
-
}
|
|
200
|
-
const textNode = getHtmlNodeTextNode(moduleScriptNode)
|
|
201
|
-
actions.push(async () => {
|
|
202
|
-
const { line, column, lineEnd, columnEnd, isOriginal } =
|
|
203
|
-
htmlNodePosition.readNodePosition(moduleScriptNode, {
|
|
204
|
-
preferOriginal: true,
|
|
205
|
-
})
|
|
206
|
-
let inlineScriptUrl = generateInlineContentUrl({
|
|
207
|
-
url: urlInfo.url,
|
|
208
|
-
extension: ".js",
|
|
209
|
-
line,
|
|
210
|
-
column,
|
|
211
|
-
lineEnd,
|
|
212
|
-
columnEnd,
|
|
213
|
-
})
|
|
214
|
-
const [inlineReference] = context.referenceUtils.foundInline({
|
|
215
|
-
node: moduleScriptNode,
|
|
216
|
-
type: "script_src",
|
|
217
|
-
expectedType: "js_module",
|
|
218
|
-
isOriginalPosition: isOriginal,
|
|
219
|
-
// we remove 1 to the line because imagine the following html:
|
|
220
|
-
// <script>console.log('ok')</script>
|
|
221
|
-
// -> content starts same line as <script>
|
|
222
|
-
specifierLine: line - 1,
|
|
223
|
-
specifierColumn: column,
|
|
224
|
-
specifier: inlineScriptUrl,
|
|
225
|
-
contentType: "application/javascript",
|
|
226
|
-
content: textNode.value,
|
|
227
|
-
})
|
|
228
|
-
const [, newUrlInfo] = await getReferenceAsJsClassic(
|
|
229
|
-
inlineReference,
|
|
230
|
-
{ cookIt: true },
|
|
231
|
-
)
|
|
232
|
-
removeHtmlNodeAttributeByName(moduleScriptNode, "type")
|
|
233
|
-
setHtmlNodeGeneratedText(moduleScriptNode, {
|
|
234
|
-
generatedText: newUrlInfo.content,
|
|
235
|
-
generatedBy: "jsenv:script_type_module_as_classic",
|
|
236
|
-
})
|
|
237
|
-
})
|
|
238
|
-
})
|
|
239
|
-
|
|
240
|
-
if (actions.length === 0) {
|
|
241
|
-
return null
|
|
242
|
-
}
|
|
243
|
-
await Promise.all(actions.map((action) => action()))
|
|
244
|
-
if (systemJsInjection) {
|
|
245
|
-
const needsSystemJs = jsModuleUrls.some(
|
|
246
|
-
(jsModuleUrl) =>
|
|
247
|
-
context.urlGraph.getUrlInfo(jsModuleUrl).data.jsClassicFormat ===
|
|
248
|
-
"system",
|
|
249
|
-
)
|
|
250
|
-
if (needsSystemJs) {
|
|
251
|
-
const [systemJsReference] = context.referenceUtils.inject({
|
|
252
|
-
type: "script_src",
|
|
253
|
-
expectedType: "js_classic",
|
|
254
|
-
specifier: systemJsClientFileUrl,
|
|
255
|
-
})
|
|
256
|
-
injectScriptAsEarlyAsPossible(
|
|
257
|
-
htmlAst,
|
|
258
|
-
createHtmlNode({
|
|
259
|
-
"tagName": "script",
|
|
260
|
-
"src": systemJsReference.generatedSpecifier,
|
|
261
|
-
"injected-by": "jsenv:script_type_module_as_classic",
|
|
262
|
-
}),
|
|
263
|
-
)
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
return stringifyHtmlAst(htmlAst)
|
|
267
|
-
},
|
|
268
|
-
},
|
|
269
|
-
}
|
|
270
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const eslintConfig = require("../../../../../../.eslintrc.cjs")
|
|
2
|
-
|
|
3
|
-
// babel helpers are copy pasted from the babel repository
|
|
4
|
-
Object.assign(eslintConfig.rules, {
|
|
5
|
-
"eqeqeq": ["off"],
|
|
6
|
-
"no-eq-null": ["off"],
|
|
7
|
-
"no-undef-init": ["off"],
|
|
8
|
-
"dot-notation": ["off"],
|
|
9
|
-
"consistent-return": ["off"],
|
|
10
|
-
"one-var": ["off"],
|
|
11
|
-
"object-shorthand": ["off"],
|
|
12
|
-
"no-return-assign": ["off"],
|
|
13
|
-
"prefer-template": ["off"],
|
|
14
|
-
"prefer-rest-params": ["off"],
|
|
15
|
-
"no-void": ["off"],
|
|
16
|
-
"no-implicit-coercion": ["off"],
|
|
17
|
-
"prefer-spread": ["off"],
|
|
18
|
-
"no-loop-func": ["off"],
|
|
19
|
-
"no-negated-condition": ["off"],
|
|
20
|
-
"no-func-assign": ["off"],
|
|
21
|
-
"no-else-return": ["off"],
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
module.exports = eslintConfig
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export const fetchOriginalUrlInfo = async ({
|
|
2
|
-
urlInfo,
|
|
3
|
-
context,
|
|
4
|
-
searchParam,
|
|
5
|
-
expectedType,
|
|
6
|
-
}) => {
|
|
7
|
-
const urlObject = new URL(urlInfo.url)
|
|
8
|
-
const { searchParams } = urlObject
|
|
9
|
-
if (!searchParams.has(searchParam)) {
|
|
10
|
-
return null
|
|
11
|
-
}
|
|
12
|
-
searchParams.delete(searchParam)
|
|
13
|
-
const originalUrl = urlObject.href
|
|
14
|
-
const originalReference = {
|
|
15
|
-
...(context.reference.original || context.reference),
|
|
16
|
-
expectedType,
|
|
17
|
-
}
|
|
18
|
-
originalReference.url = originalUrl
|
|
19
|
-
const originalUrlInfo = context.urlGraph.reuseOrCreateUrlInfo(
|
|
20
|
-
originalReference.url,
|
|
21
|
-
)
|
|
22
|
-
await context.fetchUrlContent({
|
|
23
|
-
reference: originalReference,
|
|
24
|
-
urlInfo: originalUrlInfo,
|
|
25
|
-
})
|
|
26
|
-
if (originalUrlInfo.dependents.size === 0) {
|
|
27
|
-
context.urlGraph.deleteUrlInfo(originalUrlInfo.url)
|
|
28
|
-
}
|
|
29
|
-
return originalUrlInfo
|
|
30
|
-
}
|