UNPKG

@wordpress/interactivity-router

Version:

Package that exposes state and actions from the `core/router` store, part of the Interactivity API.

64 lines (62 loc) 2.33 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // packages/interactivity-router/src/assets/dynamic-importmap/index.ts var dynamic_importmap_exports = {}; __export(dynamic_importmap_exports, { importPreloadedModule: () => import_loader2.importPreloadedModule, importWithMap: () => importWithMap, initialImportMap: () => import_loader2.initialImportMap, preloadWithMap: () => preloadWithMap }); module.exports = __toCommonJS(dynamic_importmap_exports); var import_resolver = require("./resolver.cjs"); var import_loader = require("./loader.cjs"); var import_loader2 = require("./loader.cjs"); var baseUrl = document.baseURI; var pageBaseUrl = baseUrl; Object.defineProperty(self, "wpInteractivityRouterImport", { value: importShim, writable: false, enumerable: false, configurable: false }); async function importShim(id) { await import_loader.initPromise; return (0, import_loader.topLevelLoad)((0, import_resolver.resolve)(id, pageBaseUrl), { credentials: "same-origin" }); } async function importWithMap(id, importMapIn) { (0, import_resolver.addImportMap)(importMapIn); return importShim(id); } async function preloadWithMap(id, importMapIn) { (0, import_resolver.addImportMap)(importMapIn); await import_loader.initPromise; return (0, import_loader.preloadModule)((0, import_resolver.resolve)(id, pageBaseUrl), { credentials: "same-origin" }); } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { importPreloadedModule, importWithMap, initialImportMap, preloadWithMap }); //# sourceMappingURL=index.cjs.map