@wordpress/interactivity-router 2.32.0 → 2.32.1-next.b8c8708f3.0
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/CHANGELOG.md +2 -0
- package/build/assets/dynamic-importmap/fetch.js +32 -43
- package/build/assets/dynamic-importmap/fetch.js.map +7 -1
- package/build/assets/dynamic-importmap/index.js +43 -73
- package/build/assets/dynamic-importmap/index.js.map +7 -1
- package/build/assets/dynamic-importmap/loader.js +139 -172
- package/build/assets/dynamic-importmap/loader.js.map +7 -1
- package/build/assets/dynamic-importmap/resolver.js +99 -112
- package/build/assets/dynamic-importmap/resolver.js.map +7 -1
- package/build/assets/script-modules.js +46 -58
- package/build/assets/script-modules.js.map +7 -1
- package/build/assets/scs.js +30 -39
- package/build/assets/scs.js.map +7 -1
- package/build/assets/styles.js +81 -171
- package/build/assets/styles.js.map +7 -1
- package/build/full-page.js +43 -36
- package/build/full-page.js.map +7 -1
- package/build/index.js +139 -265
- package/build/index.js.map +7 -1
- package/build-module/assets/dynamic-importmap/fetch.js +11 -39
- package/build-module/assets/dynamic-importmap/fetch.js.map +7 -1
- package/build-module/assets/dynamic-importmap/index.js +18 -52
- package/build-module/assets/dynamic-importmap/index.js.map +7 -1
- package/build-module/assets/dynamic-importmap/loader.js +101 -165
- package/build-module/assets/dynamic-importmap/loader.js.map +7 -1
- package/build-module/assets/dynamic-importmap/resolver.js +78 -108
- package/build-module/assets/dynamic-importmap/resolver.js.map +7 -1
- package/build-module/assets/script-modules.js +25 -49
- package/build-module/assets/script-modules.js.map +7 -1
- package/build-module/assets/scs.js +9 -35
- package/build-module/assets/scs.js.map +7 -1
- package/build-module/assets/styles.js +58 -163
- package/build-module/assets/styles.js.map +7 -1
- package/build-module/full-page.js +21 -32
- package/build-module/full-page.js.map +7 -1
- package/build-module/index.js +108 -257
- package/build-module/index.js.map +7 -1
- package/build-types/index.d.ts.map +1 -1
- package/package.json +12 -4
- package/src/index.ts +2 -3
- package/tsconfig.main.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,43 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var fetch_exports = {};
|
|
19
|
+
__export(fetch_exports, {
|
|
20
|
+
fetchModule: () => fetchModule
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
7
|
-
/**
|
|
8
|
-
* This code is derived from the following projects:
|
|
9
|
-
*
|
|
10
|
-
* 1. dynamic-importmap (https://github.com/keller-mark/dynamic-importmap)
|
|
11
|
-
* 2. es-module-shims (https://github.com/guybedford/es-module-shims)
|
|
12
|
-
*
|
|
13
|
-
* The original implementation was created by Guy Bedford in es-module-shims,
|
|
14
|
-
* then adapted by Mark Keller in dynamic-importmap, and further modified
|
|
15
|
-
* for use in this project.
|
|
16
|
-
*
|
|
17
|
-
* Both projects are licensed under the MIT license.
|
|
18
|
-
*
|
|
19
|
-
* MIT License: https://opensource.org/licenses/MIT
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Internal dependencies
|
|
24
|
-
*/
|
|
25
|
-
|
|
22
|
+
module.exports = __toCommonJS(fetch_exports);
|
|
26
23
|
const fetching = (url, parent) => {
|
|
27
|
-
return ` fetching ${url}${parent ? ` from ${parent}` :
|
|
24
|
+
return ` fetching ${url}${parent ? ` from ${parent}` : ""}`;
|
|
28
25
|
};
|
|
29
26
|
const jsContentType = /^(text|application)\/(x-)?javascript(;|$)/;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Fetches the passed module URL and return the corresponding `ModuleLoad`
|
|
33
|
-
* instance. If the passed URL does not point to a JS file, the function
|
|
34
|
-
* throws and error.
|
|
35
|
-
*
|
|
36
|
-
* @param url Module URL.
|
|
37
|
-
* @param fetchOpts Fetch init options.
|
|
38
|
-
* @param parent Parent module URL referencing this URL (if any).
|
|
39
|
-
* @return Promise with a `ModuleLoad` instance.
|
|
40
|
-
*/
|
|
41
27
|
async function fetchModule(url, fetchOpts, parent) {
|
|
42
28
|
let res;
|
|
43
29
|
try {
|
|
@@ -48,13 +34,16 @@ async function fetchModule(url, fetchOpts, parent) {
|
|
|
48
34
|
if (!res.ok) {
|
|
49
35
|
throw Error(`Error ${res.status}${fetching(url, parent)}.`);
|
|
50
36
|
}
|
|
51
|
-
const contentType = res.headers.get(
|
|
37
|
+
const contentType = res.headers.get("content-type");
|
|
52
38
|
if (!jsContentType.test(contentType)) {
|
|
53
|
-
throw Error(
|
|
39
|
+
throw Error(
|
|
40
|
+
`Bad Content-Type "${contentType}"${fetching(url, parent)}.`
|
|
41
|
+
);
|
|
54
42
|
}
|
|
55
|
-
return {
|
|
56
|
-
responseUrl: res.url,
|
|
57
|
-
source: await res.text()
|
|
58
|
-
};
|
|
43
|
+
return { responseUrl: res.url, source: await res.text() };
|
|
59
44
|
}
|
|
60
|
-
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
fetchModule
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=fetch.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/assets/dynamic-importmap/fetch.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * This code is derived from the following projects:\n *\n * 1. dynamic-importmap (https://github.com/keller-mark/dynamic-importmap)\n * 2. es-module-shims (https://github.com/guybedford/es-module-shims)\n *\n * The original implementation was created by Guy Bedford in es-module-shims,\n * then adapted by Mark Keller in dynamic-importmap, and further modified\n * for use in this project.\n *\n * Both projects are licensed under the MIT license.\n *\n * MIT License: https://opensource.org/licenses/MIT\n */\n\n/**\n * Internal dependencies\n */\nimport { type ModuleLoad } from './loader';\n\nconst fetching = ( url: string, parent?: string ) => {\n\treturn ` fetching ${ url }${ parent ? ` from ${ parent }` : '' }`;\n};\n\nconst jsContentType = /^(text|application)\\/(x-)?javascript(;|$)/;\n\n/**\n * Fetches the passed module URL and return the corresponding `ModuleLoad`\n * instance. If the passed URL does not point to a JS file, the function\n * throws and error.\n *\n * @param url Module URL.\n * @param fetchOpts Fetch init options.\n * @param parent Parent module URL referencing this URL (if any).\n * @return Promise with a `ModuleLoad` instance.\n */\nexport async function fetchModule(\n\turl: string,\n\tfetchOpts: RequestInit,\n\tparent: string\n): Promise< ModuleLoad > {\n\tlet res: Response;\n\ttry {\n\t\tres = await fetch( url, fetchOpts );\n\t} catch ( e ) {\n\t\tthrow Error( `Network error${ fetching( url, parent ) }.` );\n\t}\n\tif ( ! res.ok ) {\n\t\tthrow Error( `Error ${ res.status }${ fetching( url, parent ) }.` );\n\t}\n\tconst contentType = res.headers.get( 'content-type' );\n\tif ( ! jsContentType.test( contentType ) ) {\n\t\tthrow Error(\n\t\t\t`Bad Content-Type \"${ contentType }\"${ fetching( url, parent ) }.`\n\t\t);\n\t}\n\treturn { responseUrl: res.url, source: await res.text() };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBA,MAAM,WAAW,CAAE,KAAa,WAAqB;AACpD,SAAO,aAAc,GAAI,GAAI,SAAS,SAAU,MAAO,KAAK,EAAG;AAChE;AAEA,MAAM,gBAAgB;AAYtB,eAAsB,YACrB,KACA,WACA,QACwB;AACxB,MAAI;AACJ,MAAI;AACH,UAAM,MAAM,MAAO,KAAK,SAAU;AAAA,EACnC,SAAU,GAAI;AACb,UAAM,MAAO,gBAAiB,SAAU,KAAK,MAAO,CAAE,GAAI;AAAA,EAC3D;AACA,MAAK,CAAE,IAAI,IAAK;AACf,UAAM,MAAO,SAAU,IAAI,MAAO,GAAI,SAAU,KAAK,MAAO,CAAE,GAAI;AAAA,EACnE;AACA,QAAM,cAAc,IAAI,QAAQ,IAAK,cAAe;AACpD,MAAK,CAAE,cAAc,KAAM,WAAY,GAAI;AAC1C,UAAM;AAAA,MACL,qBAAsB,WAAY,IAAK,SAAU,KAAK,MAAO,CAAE;AAAA,IAChE;AAAA,EACD;AACA,SAAO,EAAE,aAAa,IAAI,KAAK,QAAQ,MAAM,IAAI,KAAK,EAAE;AACzD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,91 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () {
|
|
16
|
-
return _loader.initialImportMap;
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
14
|
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var dynamic_importmap_exports = {};
|
|
19
|
+
__export(dynamic_importmap_exports, {
|
|
20
|
+
importPreloadedModule: () => import_loader2.importPreloadedModule,
|
|
21
|
+
importWithMap: () => importWithMap,
|
|
22
|
+
initialImportMap: () => import_loader2.initialImportMap,
|
|
23
|
+
preloadWithMap: () => preloadWithMap
|
|
18
24
|
});
|
|
19
|
-
exports
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
* This code is derived from the following projects:
|
|
24
|
-
*
|
|
25
|
-
* 1. dynamic-importmap (https://github.com/keller-mark/dynamic-importmap)
|
|
26
|
-
* 2. es-module-shims (https://github.com/guybedford/es-module-shims)
|
|
27
|
-
*
|
|
28
|
-
* The original implementation was created by Guy Bedford in es-module-shims,
|
|
29
|
-
* then adapted by Mark Keller in dynamic-importmap, and further modified
|
|
30
|
-
* for use in this project.
|
|
31
|
-
*
|
|
32
|
-
* Both projects are licensed under the MIT license.
|
|
33
|
-
*
|
|
34
|
-
* MIT License: https://opensource.org/licenses/MIT
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Internal dependencies
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
// TODO: check if this baseURI should change per document, and so
|
|
42
|
-
// it need to be passed as a parameter to methods like `importWithMap`
|
|
43
|
-
// and `preloadWithMap`.
|
|
25
|
+
module.exports = __toCommonJS(dynamic_importmap_exports);
|
|
26
|
+
var import_resolver = require("./resolver");
|
|
27
|
+
var import_loader = require("./loader");
|
|
28
|
+
var import_loader2 = require("./loader");
|
|
44
29
|
const baseUrl = document.baseURI;
|
|
45
30
|
const pageBaseUrl = baseUrl;
|
|
46
|
-
Object.defineProperty(self,
|
|
31
|
+
Object.defineProperty(self, "wpInteractivityRouterImport", {
|
|
47
32
|
value: importShim,
|
|
48
33
|
writable: false,
|
|
49
34
|
enumerable: false,
|
|
50
35
|
configurable: false
|
|
51
36
|
});
|
|
52
37
|
async function importShim(id) {
|
|
53
|
-
await
|
|
54
|
-
return (0,
|
|
55
|
-
credentials:
|
|
38
|
+
await import_loader.initPromise;
|
|
39
|
+
return (0, import_loader.topLevelLoad)((0, import_resolver.resolve)(id, pageBaseUrl), {
|
|
40
|
+
credentials: "same-origin"
|
|
56
41
|
});
|
|
57
42
|
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Imports the module with the passed ID.
|
|
61
|
-
*
|
|
62
|
-
* The module is resolved against the internal dynamic import map,
|
|
63
|
-
* extended with the passed import map.
|
|
64
|
-
*
|
|
65
|
-
* @param id Module ID.
|
|
66
|
-
* @param importMapIn Import map.
|
|
67
|
-
* @return Resolved module.
|
|
68
|
-
*/
|
|
69
43
|
async function importWithMap(id, importMapIn) {
|
|
70
|
-
(0,
|
|
44
|
+
(0, import_resolver.addImportMap)(importMapIn);
|
|
71
45
|
return importShim(id);
|
|
72
46
|
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Preloads the module with the passed ID along with its dependencies.
|
|
76
|
-
*
|
|
77
|
-
* The module is resolved against the internal dynamic import map,
|
|
78
|
-
* extended with the passed import map.
|
|
79
|
-
*
|
|
80
|
-
* @param id Module ID.
|
|
81
|
-
* @param importMapIn Import map.
|
|
82
|
-
* @return Resolved `ModuleLoad` instance.
|
|
83
|
-
*/
|
|
84
47
|
async function preloadWithMap(id, importMapIn) {
|
|
85
|
-
(0,
|
|
86
|
-
await
|
|
87
|
-
return (0,
|
|
88
|
-
credentials:
|
|
48
|
+
(0, import_resolver.addImportMap)(importMapIn);
|
|
49
|
+
await import_loader.initPromise;
|
|
50
|
+
return (0, import_loader.preloadModule)((0, import_resolver.resolve)(id, pageBaseUrl), {
|
|
51
|
+
credentials: "same-origin"
|
|
89
52
|
});
|
|
90
53
|
}
|
|
91
|
-
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
importPreloadedModule,
|
|
57
|
+
importWithMap,
|
|
58
|
+
initialImportMap,
|
|
59
|
+
preloadWithMap
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/assets/dynamic-importmap/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * This code is derived from the following projects:\n *\n * 1. dynamic-importmap (https://github.com/keller-mark/dynamic-importmap)\n * 2. es-module-shims (https://github.com/guybedford/es-module-shims)\n *\n * The original implementation was created by Guy Bedford in es-module-shims,\n * then adapted by Mark Keller in dynamic-importmap, and further modified\n * for use in this project.\n *\n * Both projects are licensed under the MIT license.\n *\n * MIT License: https://opensource.org/licenses/MIT\n */\n\n/**\n * Internal dependencies\n */\nimport { addImportMap, resolve } from './resolver';\nimport { initPromise, topLevelLoad, preloadModule } from './loader';\n\ntype ImportMap = {\n\timports?: Record< string, string >;\n\tscopes?: Record< string, Record< string, string > >;\n};\n\n// TODO: check if this baseURI should change per document, and so\n// it need to be passed as a parameter to methods like `importWithMap`\n// and `preloadWithMap`.\nconst baseUrl = document.baseURI;\nconst pageBaseUrl = baseUrl;\n\nObject.defineProperty( self, 'wpInteractivityRouterImport', {\n\tvalue: importShim,\n\twritable: false,\n\tenumerable: false,\n\tconfigurable: false,\n} );\n\nasync function importShim< Module = unknown >( id: string ) {\n\tawait initPromise;\n\treturn topLevelLoad< Module >( resolve( id, pageBaseUrl ), {\n\t\tcredentials: 'same-origin',\n\t} );\n}\n\n/**\n * Imports the module with the passed ID.\n *\n * The module is resolved against the internal dynamic import map,\n * extended with the passed import map.\n *\n * @param id Module ID.\n * @param importMapIn Import map.\n * @return Resolved module.\n */\nexport async function importWithMap< Module = unknown >(\n\tid: string,\n\timportMapIn: ImportMap\n) {\n\taddImportMap( importMapIn );\n\treturn importShim< Module >( id );\n}\n\n/**\n * Preloads the module with the passed ID along with its dependencies.\n *\n * The module is resolved against the internal dynamic import map,\n * extended with the passed import map.\n *\n * @param id Module ID.\n * @param importMapIn Import map.\n * @return Resolved `ModuleLoad` instance.\n */\nexport async function preloadWithMap( id: string, importMapIn: ImportMap ) {\n\taddImportMap( importMapIn );\n\tawait initPromise;\n\treturn preloadModule( resolve( id, pageBaseUrl ), {\n\t\tcredentials: 'same-origin',\n\t} );\n}\n\nexport {\n\tinitialImportMap,\n\timportPreloadedModule,\n\ttype ModuleLoad,\n} from './loader';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBA,sBAAsC;AACtC,oBAAyD;AA+DzD,IAAAA,iBAIO;AAzDP,MAAM,UAAU,SAAS;AACzB,MAAM,cAAc;AAEpB,OAAO,eAAgB,MAAM,+BAA+B;AAAA,EAC3D,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,cAAc;AACf,CAAE;AAEF,eAAe,WAAgC,IAAa;AAC3D,QAAM;AACN,aAAO,gCAAwB,yBAAS,IAAI,WAAY,GAAG;AAAA,IAC1D,aAAa;AAAA,EACd,CAAE;AACH;AAYA,eAAsB,cACrB,IACA,aACC;AACD,oCAAc,WAAY;AAC1B,SAAO,WAAsB,EAAG;AACjC;AAYA,eAAsB,eAAgB,IAAY,aAAyB;AAC1E,oCAAc,WAAY;AAC1B,QAAM;AACN,aAAO,iCAAe,yBAAS,IAAI,WAAY,GAAG;AAAA,IACjD,aAAa;AAAA,EACd,CAAE;AACH;",
|
|
6
|
+
"names": ["import_loader"]
|
|
7
|
+
}
|