@lwrjs/loader 0.13.0-alpha.13 → 0.13.0-alpha.15
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/build/assets/prod/lwr-error-shim.js +1 -1
- package/build/assets/prod/lwr-loader-shim-legacy.bundle.js +6 -8
- package/build/assets/prod/lwr-loader-shim-legacy.bundle.min.js +2 -2
- package/build/assets/prod/lwr-loader-shim-legacy.js +5 -5
- package/build/assets/prod/lwr-loader-shim.bundle.js +6 -6
- package/build/assets/prod/lwr-loader-shim.bundle.min.js +2 -2
- package/build/assets/prod/lwr-loader-shim.js +5 -5
- package/build/cjs/modules/lwr/esmLoader/esmLoader.cjs +2 -2
- package/build/cjs/modules/lwr/loader/errors/messages.cjs +1 -1
- package/build/cjs/modules/lwr/loader/errors/reportError.cjs +1 -1
- package/build/cjs/modules/lwr/loader/hooks/moduleInvalidation.cjs +2 -2
- package/build/cjs/modules/lwr/loader/hooks/resolveAndLoadHook.cjs +3 -3
- package/build/cjs/modules/lwr/loader/moduleRegistry/importMetadataResolver.cjs +2 -2
- package/build/cjs/modules/lwr/loader/moduleRegistry/moduleRegistry.cjs +8 -8
- package/build/cjs/modules/lwr/loader/moduleRegistry/scriptLoad.cjs +2 -2
- package/build/cjs/modules/lwr/loader/utils/url.cjs +1 -1
- package/build/cjs/modules/lwr/loaderLegacy/errors/messages.cjs +1 -1
- package/build/cjs/modules/lwr/loaderLegacy/errors/reportError.cjs +1 -1
- package/build/cjs/modules/lwr/loaderLegacy/hooks/moduleInvalidation.cjs +2 -2
- package/build/cjs/modules/lwr/loaderLegacy/hooks/resolveAndLoadHook.cjs +3 -3
- package/build/cjs/modules/lwr/loaderLegacy/importMap/dom.cjs +4 -4
- package/build/cjs/modules/lwr/loaderLegacy/importMap/importMap.cjs +2 -2
- package/build/cjs/modules/lwr/loaderLegacy/importMap/importMapResolver.cjs +1 -1
- package/build/cjs/modules/lwr/loaderLegacy/importMap/utils.cjs +1 -1
- package/build/cjs/modules/lwr/loaderLegacy/moduleRegistry/moduleRegistry.cjs +7 -7
- package/build/cjs/modules/lwr/loaderLegacy/moduleRegistry/scriptLoad.cjs +2 -2
- package/build/cjs/modules/lwr/loaderLegacy/utils/url.cjs +1 -1
- package/build/modules/lwr/esmLoader/esmLoader.js +1 -1
- package/build/modules/lwr/esmLoader/importResolver.js +2 -3
- package/build/modules/lwr/esmLoader/importResolverLegacy.d.ts +1 -1
- package/build/modules/lwr/loader/errors/messages.js +1 -1
- package/build/modules/lwr/loader/errors/reportError.d.ts +1 -1
- package/build/modules/lwr/loader/errors/reportError.js +1 -1
- package/build/modules/lwr/loader/hooks/moduleInvalidation.js +2 -2
- package/build/modules/lwr/loader/hooks/resolveAndLoadHook.js +3 -3
- package/build/modules/lwr/loader/loader.d.ts +2 -2
- package/build/modules/lwr/loader/loader.js +1 -1
- package/build/modules/lwr/loader/moduleRegistry/importMetadataResolver.d.ts +1 -1
- package/build/modules/lwr/loader/moduleRegistry/importMetadataResolver.js +2 -2
- package/build/modules/lwr/loader/moduleRegistry/moduleRegistry.d.ts +2 -2
- package/build/modules/lwr/loader/moduleRegistry/moduleRegistry.js +8 -10
- package/build/modules/lwr/loader/moduleRegistry/scriptLoad.js +2 -2
- package/build/modules/lwr/loader/utils/url.js +1 -1
- package/build/modules/lwr/loaderLegacy/errors/messages.js +1 -1
- package/build/modules/lwr/loaderLegacy/errors/reportError.d.ts +1 -1
- package/build/modules/lwr/loaderLegacy/errors/reportError.js +1 -1
- package/build/modules/lwr/loaderLegacy/hooks/moduleInvalidation.js +2 -2
- package/build/modules/lwr/loaderLegacy/hooks/resolveAndLoadHook.js +3 -3
- package/build/modules/lwr/loaderLegacy/importMap/dom.d.ts +1 -1
- package/build/modules/lwr/loaderLegacy/importMap/dom.js +4 -4
- package/build/modules/lwr/loaderLegacy/importMap/importMap.js +2 -2
- package/build/modules/lwr/loaderLegacy/importMap/importMapResolver.d.ts +2 -2
- package/build/modules/lwr/loaderLegacy/importMap/importMapResolver.js +1 -1
- package/build/modules/lwr/loaderLegacy/importMap/utils.js +1 -1
- package/build/modules/lwr/loaderLegacy/importResolver/importResolver.d.ts +1 -1
- package/build/modules/lwr/loaderLegacy/loaderLegacy.d.ts +3 -3
- package/build/modules/lwr/loaderLegacy/loaderLegacy.js +1 -3
- package/build/modules/lwr/loaderLegacy/moduleRegistry/moduleRegistry.d.ts +2 -2
- package/build/modules/lwr/loaderLegacy/moduleRegistry/moduleRegistry.js +7 -9
- package/build/modules/lwr/loaderLegacy/moduleRegistry/scriptLoad.js +2 -2
- package/build/modules/lwr/loaderLegacy/utils/url.js +1 -1
- package/build/shim/customInit.d.ts +1 -1
- package/build/shim/index.js +1 -1
- package/build/shim/loader.d.ts +1 -1
- package/build/shim/shim.d.ts +1 -1
- package/build/shim/shim.js +3 -3
- package/build/shim-legacy/index.js +1 -1
- package/build/shim-legacy/loaderLegacy.d.ts +1 -1
- package/build/shim-legacy/shimLegacy.d.ts +1 -1
- package/build/shim-legacy/shimLegacy.js +3 -3
- package/build/types.d.ts +1 -1
- package/package.json +6 -6
|
@@ -26,8 +26,8 @@ __markAsModule(exports);
|
|
|
26
26
|
__export(exports, {
|
|
27
27
|
loadModuleDef: () => loadModuleDef
|
|
28
28
|
});
|
|
29
|
-
var import_messages = __toModule(require("../errors/messages"));
|
|
30
|
-
var import_dom = __toModule(require("../utils/dom"));
|
|
29
|
+
var import_messages = __toModule(require("../errors/messages.cjs"));
|
|
30
|
+
var import_dom = __toModule(require("../utils/dom.cjs"));
|
|
31
31
|
function createScript(url) {
|
|
32
32
|
const script = document.createElement("script");
|
|
33
33
|
script.async = true;
|
|
@@ -29,7 +29,7 @@ __export(exports, {
|
|
|
29
29
|
resolveIfNotPlainOrUrl: () => resolveIfNotPlainOrUrl,
|
|
30
30
|
resolveUrl: () => resolveUrl
|
|
31
31
|
});
|
|
32
|
-
var import_dom = __toModule(require("./dom"));
|
|
32
|
+
var import_dom = __toModule(require("./dom.cjs"));
|
|
33
33
|
function getBaseUrl() {
|
|
34
34
|
let baseUrl = void 0;
|
|
35
35
|
if (import_dom.hasDocument) {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6
6
|
*/
|
|
7
|
-
/* LWR ESM Module Loader v0.13.0-alpha.
|
|
7
|
+
/* LWR ESM Module Loader v0.13.0-alpha.15 */
|
|
8
8
|
function _optionalChain$1(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
9
9
|
|
|
10
10
|
|
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export default class ImportResolver {
|
|
6
6
|
constructor(config) {
|
|
7
|
-
var _a, _b;
|
|
8
7
|
this.importURICache = new Map();
|
|
9
8
|
this.modifiers = '';
|
|
10
9
|
this.normalizeMetadata(config);
|
|
11
10
|
// only fetch mappings if fingerprints is ON
|
|
12
|
-
this.mappingEndpoint =
|
|
13
|
-
if (
|
|
11
|
+
this.mappingEndpoint = config?.importMappings ? undefined : config?.endpoints?.uris.mapping;
|
|
12
|
+
if (config?.endpoints?.modifiers) {
|
|
14
13
|
// Add URI modifiers to mapping endpoint query
|
|
15
14
|
this.modifiers = Object.entries(config.endpoints.modifiers).reduce((q, [k, v]) => (q += `${k}=${v}&`), '?');
|
|
16
15
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { templateString } from './utils';
|
|
1
|
+
import { templateString } from './utils.js';
|
|
2
2
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3
3
|
function generateErrorMessage(errorInfo, args) {
|
|
4
4
|
const message = Array.isArray(args) ? templateString(errorInfo.message, args) : errorInfo.message;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hasConsole } from '../utils/dom';
|
|
1
|
+
import { hasConsole } from '../utils/dom.js';
|
|
2
2
|
function reportError(error) {
|
|
3
3
|
// TODO eventually this should be configurable instrumentation to send this somewhere
|
|
4
4
|
// eslint-disable-next-line lwr/no-unguarded-apis, no-undef
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LoaderError, STALE_HOOK_ERROR } from '../errors/messages';
|
|
2
|
-
import { reportError } from '../errors/reportError';
|
|
1
|
+
import { LoaderError, STALE_HOOK_ERROR } from '../errors/messages.js';
|
|
2
|
+
import { reportError } from '../errors/reportError.js';
|
|
3
3
|
export function evaluateHandleStaleModuleHooks(handleStaleModuleHooks, hookArgs) {
|
|
4
4
|
const { name, oldUrl, newUrl } = hookArgs;
|
|
5
5
|
// keep evaluating hooks if return value is null
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* global console,process */
|
|
2
|
-
import { LoaderError, INVALID_LOADER_SERVICE_RESPONSE, FAIL_LOAD, HTTP_FAIL_LOAD, MODULE_LOAD_TIMEOUT, FAIL_HOOK_LOAD, } from '../errors/messages';
|
|
3
|
-
import { MODULE_LOAD_TIMEOUT_TIMER } from '../constants/constants';
|
|
4
|
-
import { hasDocument, hasSetTimeout, hasConsole } from '../utils/dom';
|
|
2
|
+
import { LoaderError, INVALID_LOADER_SERVICE_RESPONSE, FAIL_LOAD, HTTP_FAIL_LOAD, MODULE_LOAD_TIMEOUT, FAIL_HOOK_LOAD, } from '../errors/messages.js';
|
|
3
|
+
import { MODULE_LOAD_TIMEOUT_TIMER } from '../constants/constants.js';
|
|
4
|
+
import { hasDocument, hasSetTimeout, hasConsole } from '../utils/dom.js';
|
|
5
5
|
// eslint-disable-next-line lwr/only-allowed-imports
|
|
6
6
|
import { trusted } from '@locker/trusted-types';
|
|
7
7
|
let lastWindowError;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Module } from './moduleRegistry/moduleRegistry';
|
|
1
|
+
import { Module } from './moduleRegistry/moduleRegistry.js';
|
|
2
2
|
import type { ServiceAPI, ImportMetadata } from '@lwrjs/types';
|
|
3
|
-
import type { FingerprintsLoaderConfig as LoaderConfig } from '../../../types';
|
|
3
|
+
import type { FingerprintsLoaderConfig as LoaderConfig } from '../../../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* The LWR loader is inspired and borrows from the algorithms and native browser principles of https://github.com/systemjs/systemjs
|
|
6
6
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6
6
|
*/
|
|
7
|
-
/* LWR Module Loader v0.13.0-alpha.
|
|
7
|
+
/* LWR Module Loader v0.13.0-alpha.15 */
|
|
8
8
|
const templateRegex = /\{([0-9]+)\}/g;
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
10
|
function templateString(template, args) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ImportMetadata, LoadMappingHook } from '@lwrjs/types';
|
|
2
|
-
import type { FingerprintsLoaderConfig as LoaderConfig } from '../../../../types';
|
|
2
|
+
import type { FingerprintsLoaderConfig as LoaderConfig } from '../../../../types.js';
|
|
3
3
|
export type InvalidationCallback = (details: {
|
|
4
4
|
name: string;
|
|
5
5
|
oldUrl: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LoaderError, BAD_IMPORT_METADATA, UNRESOLVED, UNRESOLVEABLE_MAPPING_ERROR, } from '../errors/messages';
|
|
2
|
-
import { isUrl, resolveUrl } from '../utils/url';
|
|
1
|
+
import { LoaderError, BAD_IMPORT_METADATA, UNRESOLVED, UNRESOLVEABLE_MAPPING_ERROR, } from '../errors/messages.js';
|
|
2
|
+
import { isUrl, resolveUrl } from '../utils/url.js';
|
|
3
3
|
import { MAPPINGS_ERROR, MAPPINGS_FETCH } from 'lwr/metrics';
|
|
4
4
|
/* spec based import map resolver */
|
|
5
5
|
export class ImportMetadataResolver {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ImportMetadataResolver } from './importMetadataResolver';
|
|
1
|
+
import { ImportMetadataResolver } from './importMetadataResolver.js';
|
|
2
2
|
import type { HandleStaleModuleHook, LoaderHooks, ResolveHookResponse } from '@lwrjs/types';
|
|
3
|
-
import type { LoaderConfig } from '../../../../types';
|
|
3
|
+
import type { LoaderConfig } from '../../../../types.js';
|
|
4
4
|
export type Module = {
|
|
5
5
|
[key: string]: any;
|
|
6
6
|
__useDefault?: boolean;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
/* global console,process */
|
|
2
|
-
import { invariant, NO_AMD_REQUIRE, LoaderError, FAIL_INSTANTIATE, FAILED_DEP, UNRESOLVED, INVALID_HOOK, INVALID_LOADER_SERVICE_RESPONSE, MODULE_ALREADY_LOADED, MODULE_LOAD_TIMEOUT, EXPORTER_ERROR, } from '../errors/messages';
|
|
3
|
-
import { resolveIfNotPlainOrUrl, isUrl } from '../utils/url';
|
|
4
|
-
import { hasDocument, hasConsole } from '../utils/dom';
|
|
5
|
-
import { loadModuleDef } from './scriptLoad';
|
|
6
|
-
import { ImportMetadataResolver } from './importMetadataResolver';
|
|
7
|
-
import { evaluateHandleStaleModuleHooks } from '../hooks/moduleInvalidation';
|
|
8
|
-
import { evaluateLoadHookResponse, evaluateLoadHook, isResponseAPromise } from '../hooks/resolveAndLoadHook';
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
10
|
-
// @ts-ignore LWC type needed
|
|
2
|
+
import { invariant, NO_AMD_REQUIRE, LoaderError, FAIL_INSTANTIATE, FAILED_DEP, UNRESOLVED, INVALID_HOOK, INVALID_LOADER_SERVICE_RESPONSE, MODULE_ALREADY_LOADED, MODULE_LOAD_TIMEOUT, EXPORTER_ERROR, } from '../errors/messages.js';
|
|
3
|
+
import { resolveIfNotPlainOrUrl, isUrl } from '../utils/url.js';
|
|
4
|
+
import { hasDocument, hasConsole } from '../utils/dom.js';
|
|
5
|
+
import { loadModuleDef } from './scriptLoad.js';
|
|
6
|
+
import { ImportMetadataResolver } from './importMetadataResolver.js';
|
|
7
|
+
import { evaluateHandleStaleModuleHooks } from '../hooks/moduleInvalidation.js';
|
|
8
|
+
import { evaluateLoadHookResponse, evaluateLoadHook, isResponseAPromise, } from '../hooks/resolveAndLoadHook.js';
|
|
11
9
|
import { MODULE_DEFINE, MODULE_ERROR, MODULE_FETCH, MODULE_DYNAMIC_LOAD } from 'lwr/metrics';
|
|
12
|
-
import { MODULE_LOAD_TIMEOUT_TIMER } from '../constants/constants';
|
|
10
|
+
import { MODULE_LOAD_TIMEOUT_TIMER } from '../constants/constants.js';
|
|
13
11
|
export class ModuleRegistry {
|
|
14
12
|
constructor(config) {
|
|
15
13
|
// A registry for named AMD defines containing the *metadata* of AMD module
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LoaderError, FAIL_LOAD } from '../errors/messages';
|
|
2
|
-
import { hasDocument } from '../utils/dom';
|
|
1
|
+
import { LoaderError, FAIL_LOAD } from '../errors/messages.js';
|
|
2
|
+
import { hasDocument } from '../utils/dom.js';
|
|
3
3
|
function createScript(url) {
|
|
4
4
|
// eslint-disable-next-line lwr/no-unguarded-apis, no-undef
|
|
5
5
|
const script = document.createElement('script');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { templateString } from './utils';
|
|
1
|
+
import { templateString } from './utils.js';
|
|
2
2
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3
3
|
function generateErrorMessage(errorInfo, args) {
|
|
4
4
|
const message = Array.isArray(args) ? templateString(errorInfo.message, args) : errorInfo.message;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hasConsole } from '../utils/dom';
|
|
1
|
+
import { hasConsole } from '../utils/dom.js';
|
|
2
2
|
function reportError(error) {
|
|
3
3
|
// TODO eventually this should be configurable instrumentation to send this somewhere
|
|
4
4
|
// eslint-disable-next-line lwr/no-unguarded-apis, no-undef
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LoaderError, STALE_HOOK_ERROR } from '../errors/messages';
|
|
2
|
-
import { reportError } from '../errors/reportError';
|
|
1
|
+
import { LoaderError, STALE_HOOK_ERROR } from '../errors/messages.js';
|
|
2
|
+
import { reportError } from '../errors/reportError.js';
|
|
3
3
|
export function evaluateHandleStaleModuleHooks(handleStaleModuleHooks, hookArgs) {
|
|
4
4
|
const { name, oldHash, newHash } = hookArgs;
|
|
5
5
|
// keep evaluating hooks if return value is null
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* global console,process */
|
|
2
|
-
import { LoaderError, INVALID_LOADER_SERVICE_RESPONSE, FAIL_LOAD, HTTP_FAIL_LOAD, MODULE_LOAD_TIMEOUT, FAIL_HOOK_LOAD, } from '../errors/messages';
|
|
3
|
-
import { MODULE_LOAD_TIMEOUT_TIMER } from '../constants/constants';
|
|
4
|
-
import { hasDocument, hasSetTimeout, hasConsole } from '../utils/dom';
|
|
2
|
+
import { LoaderError, INVALID_LOADER_SERVICE_RESPONSE, FAIL_LOAD, HTTP_FAIL_LOAD, MODULE_LOAD_TIMEOUT, FAIL_HOOK_LOAD, } from '../errors/messages.js';
|
|
3
|
+
import { MODULE_LOAD_TIMEOUT_TIMER } from '../constants/constants.js';
|
|
4
|
+
import { hasDocument, hasSetTimeout, hasConsole } from '../utils/dom.js';
|
|
5
5
|
// eslint-disable-next-line lwr/only-allowed-imports
|
|
6
6
|
import { trusted } from '@locker/trusted-types';
|
|
7
7
|
let lastWindowError;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This implementation is adapted from https://github.com/systemjs/systemjs/blob/master/src/features/import-map.js
|
|
5
5
|
*/
|
|
6
|
-
import { ImportMap } from './importMap';
|
|
6
|
+
import { ImportMap } from './importMap.js';
|
|
7
7
|
declare const IMPORTMAP_SCRIPT_TYPE = "lwr-importmap";
|
|
8
8
|
declare function evaluateImportMaps(baseUrl?: string): Promise<ImportMap | undefined>;
|
|
9
9
|
export { IMPORTMAP_SCRIPT_TYPE, evaluateImportMaps };
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This implementation is adapted from https://github.com/systemjs/systemjs/blob/master/src/features/import-map.js
|
|
5
5
|
*/
|
|
6
|
-
import { resolveAndComposeImportMap } from './importMap';
|
|
7
|
-
import { getBaseUrl } from '../utils/url';
|
|
8
|
-
import { hasDocument, hasConsole } from '../utils/dom';
|
|
9
|
-
import { LoaderError, BAD_IMPORT_MAP, NO_BASE_URL } from '../errors/messages';
|
|
6
|
+
import { resolveAndComposeImportMap } from './importMap.js';
|
|
7
|
+
import { getBaseUrl } from '../utils/url.js';
|
|
8
|
+
import { hasDocument, hasConsole } from '../utils/dom.js';
|
|
9
|
+
import { LoaderError, BAD_IMPORT_MAP, NO_BASE_URL } from '../errors/messages.js';
|
|
10
10
|
const IMPORTMAP_SCRIPT_TYPE = 'lwr-importmap';
|
|
11
11
|
// iterates on the any <script type="${IMPORTMAP_SCRIPT_TYPE}", invoking the given callback for each
|
|
12
12
|
function iterateDocumentImportMaps(callBack, extraSelector) {
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* This implementation is adapted from https://github.com/systemjs/systemjs/blob/master/src/features/import-map.js
|
|
5
5
|
*/
|
|
6
|
-
import { resolveUrl, resolveIfNotPlainOrUrl, isUrl } from '../utils/url';
|
|
7
|
-
import { getMatch, targetWarning } from './utils';
|
|
6
|
+
import { resolveUrl, resolveIfNotPlainOrUrl, isUrl } from '../utils/url.js';
|
|
7
|
+
import { getMatch, targetWarning } from './utils.js';
|
|
8
8
|
// Resolves an import map package entry
|
|
9
9
|
function applyPackages(id, packages, defaultUri) {
|
|
10
10
|
const pkgName = getMatch(id, packages);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ImportDefinition, ImportMap } from './importMap';
|
|
2
|
-
import type { ImportResolver } from '../importResolver/importResolver';
|
|
1
|
+
import type { ImportDefinition, ImportMap } from './importMap.js';
|
|
2
|
+
import type { ImportResolver } from '../importResolver/importResolver.js';
|
|
3
3
|
export declare class ImportMapResolver implements ImportResolver {
|
|
4
4
|
importMap: ImportMap;
|
|
5
5
|
constructor(importMap: ImportMap);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hasConsole } from '../utils/dom';
|
|
1
|
+
import { hasConsole } from '../utils/dom.js';
|
|
2
2
|
// find the longest set of segments from path which are a key in matchObj
|
|
3
3
|
// eg: getMatch('/a/b/c', { '/a/b': ..., '/a': ..., '/d/e/f': ...}) => '/a/b'
|
|
4
4
|
function getMatch(path, matchObj) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ImportDefinition, ImportMap } from '../importMap/importMap';
|
|
1
|
+
import type { ImportDefinition, ImportMap } from '../importMap/importMap.js';
|
|
2
2
|
export interface ImportResolver {
|
|
3
3
|
importMap: ImportMap;
|
|
4
4
|
resolve(resolvedOrPlain: string, parentUrl: string): ImportDefinition | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Module, ModuleDefinitionSignatures } from './moduleRegistry/moduleRegistry';
|
|
2
|
-
import { ImportMap } from './importMap/importMap';
|
|
1
|
+
import { Module, ModuleDefinitionSignatures } from './moduleRegistry/moduleRegistry.js';
|
|
2
|
+
import { ImportMap } from './importMap/importMap.js';
|
|
3
3
|
import type { ServiceAPI } from '@lwrjs/types';
|
|
4
|
-
import type { LoaderConfig } from '../../../types';
|
|
4
|
+
import type { LoaderConfig } from '../../../types.js';
|
|
5
5
|
/**
|
|
6
6
|
* The LWR loader is inspired and borrows from the algorithms and native browser principles of https://github.com/systemjs/systemjs
|
|
7
7
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
|
6
6
|
*/
|
|
7
|
-
/* LWR Legacy Module Loader v0.13.0-alpha.
|
|
7
|
+
/* LWR Legacy Module Loader v0.13.0-alpha.15 */
|
|
8
8
|
const templateRegex = /\{([0-9]+)\}/g;
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
10
|
function templateString(template, args) {
|
|
@@ -572,8 +572,6 @@ const MODULE_ERROR = `${LOADER_PREFIX}module.error`;
|
|
|
572
572
|
|
|
573
573
|
|
|
574
574
|
|
|
575
|
-
|
|
576
|
-
|
|
577
575
|
|
|
578
576
|
|
|
579
577
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ImportMapResolver } from '../importMap/importMapResolver';
|
|
1
|
+
import type { ImportMapResolver } from '../importMap/importMapResolver.js';
|
|
2
2
|
import type { HandleStaleModuleHook, LoaderHooks, ResolveHookResponse } from '@lwrjs/types';
|
|
3
|
-
import type { LoaderConfig } from '../../../../types';
|
|
3
|
+
import type { LoaderConfig } from '../../../../types.js';
|
|
4
4
|
export type ModuleDefinitionSignatures = {
|
|
5
5
|
ownHash: string;
|
|
6
6
|
hashes: {
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/* global console,process */
|
|
2
|
-
import { invariant, NO_AMD_REQUIRE, LoaderError, FAIL_INSTANTIATE, FAILED_DEP, UNRESOLVED, INVALID_HOOK, INVALID_LOADER_SERVICE_RESPONSE, MODULE_ALREADY_LOADED, MODULE_LOAD_TIMEOUT, EXPORTER_ERROR, } from '../errors/messages';
|
|
3
|
-
import { resolveIfNotPlainOrUrl, isUrl } from '../utils/url';
|
|
4
|
-
import { hasDocument, hasConsole } from '../utils/dom';
|
|
5
|
-
import { loadModuleDef } from './scriptLoad';
|
|
6
|
-
import { evaluateLoadHookResponse, evaluateLoadHook, isResponseAPromise } from '../hooks/resolveAndLoadHook';
|
|
7
|
-
import { evaluateHandleStaleModuleHooks } from '../hooks/moduleInvalidation';
|
|
8
|
-
import { MODULE_LOAD_TIMEOUT_TIMER } from '../constants/constants';
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
10
|
-
// @ts-ignore LWC type needed
|
|
2
|
+
import { invariant, NO_AMD_REQUIRE, LoaderError, FAIL_INSTANTIATE, FAILED_DEP, UNRESOLVED, INVALID_HOOK, INVALID_LOADER_SERVICE_RESPONSE, MODULE_ALREADY_LOADED, MODULE_LOAD_TIMEOUT, EXPORTER_ERROR, } from '../errors/messages.js';
|
|
3
|
+
import { resolveIfNotPlainOrUrl, isUrl } from '../utils/url.js';
|
|
4
|
+
import { hasDocument, hasConsole } from '../utils/dom.js';
|
|
5
|
+
import { loadModuleDef } from './scriptLoad.js';
|
|
6
|
+
import { evaluateLoadHookResponse, evaluateLoadHook, isResponseAPromise, } from '../hooks/resolveAndLoadHook.js';
|
|
7
|
+
import { evaluateHandleStaleModuleHooks } from '../hooks/moduleInvalidation.js';
|
|
8
|
+
import { MODULE_LOAD_TIMEOUT_TIMER } from '../constants/constants.js';
|
|
11
9
|
import { MODULE_DEFINE, MODULE_ERROR, MODULE_FETCH, MODULE_DYNAMIC_LOAD } from 'lwr/metrics';
|
|
12
10
|
export class ModuleRegistry {
|
|
13
11
|
constructor(config) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LoaderError, FAIL_LOAD } from '../errors/messages';
|
|
2
|
-
import { hasDocument } from '../utils/dom';
|
|
1
|
+
import { LoaderError, FAIL_LOAD } from '../errors/messages.js';
|
|
2
|
+
import { hasDocument } from '../utils/dom.js';
|
|
3
3
|
function createScript(url) {
|
|
4
4
|
// eslint-disable-next-line lwr/no-unguarded-apis, no-undef
|
|
5
5
|
const script = document.createElement('script');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ClientBootstrapConfig } from '@lwrjs/types';
|
|
2
|
-
import type { InitializeApp, LoaderDefine, RegisterCustomErrorHandler } from '../types';
|
|
2
|
+
import type { InitializeApp, LoaderDefine, RegisterCustomErrorHandler } from '../types.js';
|
|
3
3
|
export declare function customInit(config: ClientBootstrapConfig, initializeApp: InitializeApp, define: LoaderDefine, onBootstrapError: RegisterCustomErrorHandler): void;
|
|
4
4
|
//# sourceMappingURL=customInit.d.ts.map
|
package/build/shim/index.js
CHANGED
package/build/shim/loader.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { DefineArguments, FingerprintsLoaderAPI as LoaderAPI, FingerprintsLoaderConfig as LoaderConfig } from '../types';
|
|
1
|
+
import type { DefineArguments, FingerprintsLoaderAPI as LoaderAPI, FingerprintsLoaderConfig as LoaderConfig } from '../types.js';
|
|
2
2
|
export declare function createLoader(name: string, definition: DefineArguments, config: LoaderConfig, externalModules?: string[]): LoaderAPI;
|
|
3
3
|
//# sourceMappingURL=loader.d.ts.map
|
package/build/shim/shim.d.ts
CHANGED
package/build/shim/shim.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* global document */
|
|
2
2
|
import { BOOTSTRAP_ERROR } from 'lwr/metrics';
|
|
3
3
|
import { logOperationStart, logOperationEnd } from 'lwr/profiler';
|
|
4
|
-
import { createLoader } from './loader';
|
|
5
|
-
import { REQUIRED_MODULES_TIMEOUT } from './constants';
|
|
6
|
-
import { customInit } from './customInit';
|
|
4
|
+
import { createLoader } from './loader.js';
|
|
5
|
+
import { REQUIRED_MODULES_TIMEOUT } from './constants.js';
|
|
6
|
+
import { customInit } from './customInit.js';
|
|
7
7
|
/* eslint-disable lwr/no-unguarded-apis */
|
|
8
8
|
const hasSetTimeout = typeof setTimeout === 'function';
|
|
9
9
|
const hasConsole = typeof console !== 'undefined';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { LoaderConfig, DefineArguments, LoaderAPI } from '../types';
|
|
1
|
+
import type { LoaderConfig, DefineArguments, LoaderAPI } from '../types.js';
|
|
2
2
|
export declare function createLoader(name: string, definition: DefineArguments, config: LoaderConfig, externalModules?: string[]): LoaderAPI;
|
|
3
3
|
//# sourceMappingURL=loaderLegacy.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* global document */
|
|
2
2
|
import { BOOTSTRAP_ERROR } from 'lwr/metrics';
|
|
3
3
|
import { logOperationStart, logOperationEnd } from 'lwr/profiler';
|
|
4
|
-
import { createLoader } from './loaderLegacy';
|
|
5
|
-
import { REQUIRED_MODULES_TIMEOUT } from '../shim/constants';
|
|
6
|
-
import { customInit } from '../shim/customInit';
|
|
4
|
+
import { createLoader } from './loaderLegacy.js';
|
|
5
|
+
import { REQUIRED_MODULES_TIMEOUT } from '../shim/constants.js';
|
|
6
|
+
import { customInit } from '../shim/customInit.js';
|
|
7
7
|
/* eslint-disable lwr/no-unguarded-apis */
|
|
8
8
|
const hasSetTimeout = typeof setTimeout === 'function';
|
|
9
9
|
const hasConsole = typeof console !== 'undefined';
|
package/build/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ImportMetadata, AppMetadata, ServerData, ClientBootstrapConfig } from '@lwrjs/types';
|
|
2
|
-
import type { ImportMap } from './modules/lwr/loaderLegacy/importMap/importMap';
|
|
2
|
+
import type { ImportMap } from './modules/lwr/loaderLegacy/importMap/importMap.js';
|
|
3
3
|
import type { ProfilerAPI, LogDispatcher } from 'lwr/profiler';
|
|
4
4
|
export type GlobalThis = {
|
|
5
5
|
LWR: Partial<ClientBootstrapConfig> & {
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
|
-
"version": "0.13.0-alpha.
|
|
8
|
+
"version": "0.13.0-alpha.15",
|
|
9
9
|
"homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -61,16 +61,16 @@
|
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@locker/trusted-types": "0.22.2",
|
|
64
|
-
"@lwrjs/diagnostics": "0.13.0-alpha.
|
|
65
|
-
"@lwrjs/types": "0.13.0-alpha.
|
|
64
|
+
"@lwrjs/diagnostics": "0.13.0-alpha.15",
|
|
65
|
+
"@lwrjs/types": "0.13.0-alpha.15",
|
|
66
66
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
67
67
|
"@rollup/plugin-sucrase": "^5.0.2",
|
|
68
68
|
"@rollup/plugin-terser": "^0.4.4",
|
|
69
69
|
"rollup": "^2.78.0"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@lwrjs/client-modules": "0.13.0-alpha.
|
|
73
|
-
"@lwrjs/shared-utils": "0.13.0-alpha.
|
|
72
|
+
"@lwrjs/client-modules": "0.13.0-alpha.15",
|
|
73
|
+
"@lwrjs/shared-utils": "0.13.0-alpha.15"
|
|
74
74
|
},
|
|
75
75
|
"lwc": {
|
|
76
76
|
"modules": [
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"volta": {
|
|
91
91
|
"extends": "../../../package.json"
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "d5eab85249493caf8766c4bc400b11d9c0a9909e"
|
|
94
94
|
}
|