@kaena1/mm-ui-shared-utils 1.25.0-f-poc-EC-3301.2 → 1.25.0-f-poc-EC-3301.3
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/_virtual/_commonjsHelpers.js +6 -0
- package/dist/_virtual/_interop_require_default.js +4 -0
- package/dist/_virtual/_interop_require_wildcard.js +4 -0
- package/dist/_virtual/head-manager-context.shared-runtime.js +4 -0
- package/dist/_virtual/head-manager.js +4 -0
- package/dist/_virtual/request-idle-callback.js +4 -0
- package/dist/_virtual/script.js +4 -0
- package/dist/components/ImportMapScripts.js +2 -1
- package/dist/hooks/useRemoteComponent.js +2 -0
- package/dist/index.d.ts +49 -3
- package/dist/index.js +6 -1
- package/dist/node_modules/@swc/helpers/cjs/_interop_require_default.js +8 -0
- package/dist/node_modules/@swc/helpers/cjs/_interop_require_wildcard.js +31 -0
- package/dist/node_modules/next/dist/client/head-manager.js +206 -0
- package/dist/node_modules/next/dist/client/request-idle-callback.js +48 -0
- package/dist/node_modules/next/dist/client/script.js +298 -0
- package/dist/node_modules/next/dist/shared/lib/head-manager-context.shared-runtime.js +30 -0
- package/dist/node_modules/next/script.js +7 -0
- package/dist/packages/shared-utils/package.json.js +11 -0
- package/dist/services/ImportMapScript.js +26 -0
- package/dist/services/ImportMapService.js +61 -0
- package/package.json +5 -1
- package/dist/services/generateImportMap.js +0 -14
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import "react-dom";
|
|
4
|
-
import { generateImportMapJson } from "../services/
|
|
4
|
+
import { generateImportMapJson } from "../services/ImportMapService.js";
|
|
5
|
+
import "../node_modules/next/dist/client/script.js";
|
|
5
6
|
const ImportMapScripts = () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6
7
|
/* @__PURE__ */ jsx(
|
|
7
8
|
"script",
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { useState, useCallback, useEffect } from "react";
|
|
2
2
|
import { moduleLoader } from "../services/moduleLoader.js";
|
|
3
|
+
import "react/jsx-runtime";
|
|
4
|
+
import "../node_modules/next/dist/client/script.js";
|
|
3
5
|
function useRemoteComponent(options) {
|
|
4
6
|
const {
|
|
5
7
|
manifest: manifestFromProps,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
|
|
1
3
|
import { default as default_2 } from 'react';
|
|
2
4
|
|
|
3
5
|
export declare interface ComponentManifest {
|
|
@@ -8,13 +10,57 @@ export declare interface ComponentManifest {
|
|
|
8
10
|
export declare function fetchManifest(manifestUrl: string): Promise<RemoteManifest>;
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
+
* Generate complete import map object for remote components
|
|
14
|
+
*
|
|
15
|
+
* @param config - Optional configuration to override default settings
|
|
16
|
+
* @returns Import map object ready for browser consumption
|
|
17
|
+
*/
|
|
18
|
+
export declare const generateImportMap: (config?: ImportMapConfig) => object;
|
|
19
|
+
|
|
20
|
+
export declare const generateImportMapJson: (config?: ImportMapConfig) => string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Get import map script props for Next.js Script component
|
|
24
|
+
*
|
|
25
|
+
* @param config - Optional configuration to override default settings
|
|
26
|
+
* @returns Props object with type and dangerouslySetInnerHTML for Script component
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* <Script {...getImportMapScriptProps()} strategy="beforeInteractive" />
|
|
30
|
+
* ```
|
|
13
31
|
*/
|
|
14
|
-
export declare
|
|
32
|
+
export declare const getImportMapScriptProps: (config?: ImportMapConfig) => {
|
|
33
|
+
type: "importmap-shim";
|
|
34
|
+
dangerouslySetInnerHTML: {
|
|
35
|
+
__html: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export declare interface ImportMapConfig {
|
|
40
|
+
reactVersion?: string;
|
|
41
|
+
reactDomVersion?: string;
|
|
42
|
+
customImports?: Record<string, string>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export declare const ImportMapScript: React.FC<ImportMapScriptProps>;
|
|
46
|
+
|
|
47
|
+
declare interface ImportMapScriptProps {
|
|
48
|
+
reactVersion?: string;
|
|
49
|
+
reactDomVersion?: string;
|
|
50
|
+
customImports?: Record<string, string>;
|
|
51
|
+
strategy?: 'beforeInteractive' | 'afterInteractive' | 'lazyOnload';
|
|
52
|
+
}
|
|
15
53
|
|
|
16
54
|
export declare const ImportMapScripts: default_2.FC;
|
|
17
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Validate browser support for import maps
|
|
58
|
+
*
|
|
59
|
+
* @returns true if the browser supports import maps, false otherwise
|
|
60
|
+
* @see https://caniuse.com/import-maps
|
|
61
|
+
*/
|
|
62
|
+
export declare const isImportMapSupported: () => boolean;
|
|
63
|
+
|
|
18
64
|
export declare class ModuleLoader {
|
|
19
65
|
private loadedModules;
|
|
20
66
|
private importMapInjected;
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { fetchManifest } from "./services/fetchManifest.js";
|
|
2
2
|
import { ModuleLoader, moduleLoader } from "./services/moduleLoader.js";
|
|
3
|
-
import { generateImportMapJson } from "./services/
|
|
3
|
+
import { generateImportMap, generateImportMapJson, getImportMapScriptProps, isImportMapSupported } from "./services/ImportMapService.js";
|
|
4
|
+
import { ImportMapScript } from "./services/ImportMapScript.js";
|
|
4
5
|
import { useRemoteComponent } from "./hooks/useRemoteComponent.js";
|
|
5
6
|
import { RemoteRenderer } from "./components/RemoteRenderer.js";
|
|
6
7
|
import { RemoteLinks } from "./components/RemoteLinks.js";
|
|
7
8
|
import { ImportMapScripts } from "./components/ImportMapScripts.js";
|
|
8
9
|
export {
|
|
10
|
+
ImportMapScript,
|
|
9
11
|
ImportMapScripts,
|
|
10
12
|
ModuleLoader,
|
|
11
13
|
RemoteLinks,
|
|
12
14
|
RemoteRenderer,
|
|
13
15
|
fetchManifest,
|
|
16
|
+
generateImportMap,
|
|
14
17
|
generateImportMapJson,
|
|
18
|
+
getImportMapScriptProps,
|
|
19
|
+
isImportMapSupported,
|
|
15
20
|
moduleLoader,
|
|
16
21
|
useRemoteComponent
|
|
17
22
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { __exports as _interop_require_default$1 } from "../../../../_virtual/_interop_require_default.js";
|
|
2
|
+
_interop_require_default$1._ = _interop_require_default$1._interop_require_default = _interop_require_default;
|
|
3
|
+
function _interop_require_default(obj) {
|
|
4
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
5
|
+
}
|
|
6
|
+
export {
|
|
7
|
+
_interop_require_default$1 as default
|
|
8
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { __exports as _interop_require_wildcard$1 } from "../../../../_virtual/_interop_require_wildcard.js";
|
|
2
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
3
|
+
if (typeof WeakMap !== "function") return null;
|
|
4
|
+
var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
|
|
5
|
+
var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
|
|
6
|
+
return (_getRequireWildcardCache = function(nodeInterop2) {
|
|
7
|
+
return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
|
|
8
|
+
})(nodeInterop);
|
|
9
|
+
}
|
|
10
|
+
_interop_require_wildcard$1._ = _interop_require_wildcard$1._interop_require_wildcard = _interop_require_wildcard;
|
|
11
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
12
|
+
if (!nodeInterop && obj && obj.__esModule) return obj;
|
|
13
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") return { default: obj };
|
|
14
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
15
|
+
if (cache && cache.has(obj)) return cache.get(obj);
|
|
16
|
+
var newObj = { __proto__: null };
|
|
17
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
18
|
+
for (var key in obj) {
|
|
19
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
20
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
21
|
+
if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
|
|
22
|
+
else newObj[key] = obj[key];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
newObj.default = obj;
|
|
26
|
+
if (cache) cache.set(obj, newObj);
|
|
27
|
+
return newObj;
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
_interop_require_wildcard$1 as default
|
|
31
|
+
};
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { __module as headManager } from "../../../../_virtual/head-manager.js";
|
|
2
|
+
var hasRequiredHeadManager;
|
|
3
|
+
function requireHeadManager() {
|
|
4
|
+
if (hasRequiredHeadManager) return headManager.exports;
|
|
5
|
+
hasRequiredHeadManager = 1;
|
|
6
|
+
(function(module, exports$1) {
|
|
7
|
+
Object.defineProperty(exports$1, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
function _export(target, all) {
|
|
11
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: all[name]
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
_export(exports$1, {
|
|
17
|
+
DOMAttributeNames: function() {
|
|
18
|
+
return DOMAttributeNames;
|
|
19
|
+
},
|
|
20
|
+
default: function() {
|
|
21
|
+
return initHeadManager;
|
|
22
|
+
},
|
|
23
|
+
isEqualNode: function() {
|
|
24
|
+
return isEqualNode;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
const DOMAttributeNames = {
|
|
28
|
+
acceptCharset: "accept-charset",
|
|
29
|
+
className: "class",
|
|
30
|
+
htmlFor: "for",
|
|
31
|
+
httpEquiv: "http-equiv",
|
|
32
|
+
noModule: "noModule"
|
|
33
|
+
};
|
|
34
|
+
function reactElementToDOM(param) {
|
|
35
|
+
let { type, props } = param;
|
|
36
|
+
const el = document.createElement(type);
|
|
37
|
+
for (const p in props) {
|
|
38
|
+
if (!props.hasOwnProperty(p)) continue;
|
|
39
|
+
if (p === "children" || p === "dangerouslySetInnerHTML") continue;
|
|
40
|
+
if (props[p] === void 0) continue;
|
|
41
|
+
const attr = DOMAttributeNames[p] || p.toLowerCase();
|
|
42
|
+
if (type === "script" && (attr === "async" || attr === "defer" || attr === "noModule")) {
|
|
43
|
+
el[attr] = !!props[p];
|
|
44
|
+
} else {
|
|
45
|
+
el.setAttribute(attr, props[p]);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const { children, dangerouslySetInnerHTML } = props;
|
|
49
|
+
if (dangerouslySetInnerHTML) {
|
|
50
|
+
el.innerHTML = dangerouslySetInnerHTML.__html || "";
|
|
51
|
+
} else if (children) {
|
|
52
|
+
el.textContent = typeof children === "string" ? children : Array.isArray(children) ? children.join("") : "";
|
|
53
|
+
}
|
|
54
|
+
return el;
|
|
55
|
+
}
|
|
56
|
+
function isEqualNode(oldTag, newTag) {
|
|
57
|
+
if (oldTag instanceof HTMLElement && newTag instanceof HTMLElement) {
|
|
58
|
+
const nonce = newTag.getAttribute("nonce");
|
|
59
|
+
if (nonce && !oldTag.getAttribute("nonce")) {
|
|
60
|
+
const cloneTag = newTag.cloneNode(true);
|
|
61
|
+
cloneTag.setAttribute("nonce", "");
|
|
62
|
+
cloneTag.nonce = nonce;
|
|
63
|
+
return nonce === oldTag.nonce && oldTag.isEqualNode(cloneTag);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return oldTag.isEqualNode(newTag);
|
|
67
|
+
}
|
|
68
|
+
let updateElements;
|
|
69
|
+
if (process.env.__NEXT_STRICT_NEXT_HEAD) {
|
|
70
|
+
updateElements = (type, components) => {
|
|
71
|
+
const headEl = document.querySelector("head");
|
|
72
|
+
if (!headEl) return;
|
|
73
|
+
const headMetaTags = headEl.querySelectorAll('meta[name="next-head"]') || [];
|
|
74
|
+
const oldTags = [];
|
|
75
|
+
if (type === "meta") {
|
|
76
|
+
const metaCharset = headEl.querySelector("meta[charset]");
|
|
77
|
+
if (metaCharset) {
|
|
78
|
+
oldTags.push(metaCharset);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
for (let i = 0; i < headMetaTags.length; i++) {
|
|
82
|
+
var _headTag_tagName;
|
|
83
|
+
const metaTag = headMetaTags[i];
|
|
84
|
+
const headTag = metaTag.nextSibling;
|
|
85
|
+
if ((headTag == null ? void 0 : (_headTag_tagName = headTag.tagName) == null ? void 0 : _headTag_tagName.toLowerCase()) === type) {
|
|
86
|
+
oldTags.push(headTag);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const newTags = components.map(reactElementToDOM).filter((newTag) => {
|
|
90
|
+
for (let k = 0, len = oldTags.length; k < len; k++) {
|
|
91
|
+
const oldTag = oldTags[k];
|
|
92
|
+
if (isEqualNode(oldTag, newTag)) {
|
|
93
|
+
oldTags.splice(k, 1);
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return true;
|
|
98
|
+
});
|
|
99
|
+
oldTags.forEach((t) => {
|
|
100
|
+
var _t_parentNode;
|
|
101
|
+
const metaTag = t.previousSibling;
|
|
102
|
+
if (metaTag && metaTag.getAttribute("name") === "next-head") {
|
|
103
|
+
var _t_parentNode1;
|
|
104
|
+
(_t_parentNode1 = t.parentNode) == null ? void 0 : _t_parentNode1.removeChild(metaTag);
|
|
105
|
+
}
|
|
106
|
+
(_t_parentNode = t.parentNode) == null ? void 0 : _t_parentNode.removeChild(t);
|
|
107
|
+
});
|
|
108
|
+
newTags.forEach((t) => {
|
|
109
|
+
var _t_tagName;
|
|
110
|
+
const meta = document.createElement("meta");
|
|
111
|
+
meta.name = "next-head";
|
|
112
|
+
meta.content = "1";
|
|
113
|
+
if (!(((_t_tagName = t.tagName) == null ? void 0 : _t_tagName.toLowerCase()) === "meta" && t.getAttribute("charset"))) {
|
|
114
|
+
headEl.appendChild(meta);
|
|
115
|
+
}
|
|
116
|
+
headEl.appendChild(t);
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
} else {
|
|
120
|
+
updateElements = (type, components) => {
|
|
121
|
+
const headEl = document.getElementsByTagName("head")[0];
|
|
122
|
+
const headCountEl = headEl.querySelector("meta[name=next-head-count]");
|
|
123
|
+
if (process.env.NODE_ENV !== "production") {
|
|
124
|
+
if (!headCountEl) {
|
|
125
|
+
console.error("Warning: next-head-count is missing. https://nextjs.org/docs/messages/next-head-count-missing");
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const headCount = Number(headCountEl.content);
|
|
130
|
+
const oldTags = [];
|
|
131
|
+
for (let i = 0, j = headCountEl.previousElementSibling; i < headCount; i++, j = (j == null ? void 0 : j.previousElementSibling) || null) {
|
|
132
|
+
var _j_tagName;
|
|
133
|
+
if ((j == null ? void 0 : (_j_tagName = j.tagName) == null ? void 0 : _j_tagName.toLowerCase()) === type) {
|
|
134
|
+
oldTags.push(j);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const newTags = components.map(reactElementToDOM).filter((newTag) => {
|
|
138
|
+
for (let k = 0, len = oldTags.length; k < len; k++) {
|
|
139
|
+
const oldTag = oldTags[k];
|
|
140
|
+
if (isEqualNode(oldTag, newTag)) {
|
|
141
|
+
oldTags.splice(k, 1);
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return true;
|
|
146
|
+
});
|
|
147
|
+
oldTags.forEach((t) => {
|
|
148
|
+
var _t_parentNode;
|
|
149
|
+
return (_t_parentNode = t.parentNode) == null ? void 0 : _t_parentNode.removeChild(t);
|
|
150
|
+
});
|
|
151
|
+
newTags.forEach((t) => headEl.insertBefore(t, headCountEl));
|
|
152
|
+
headCountEl.content = (headCount - oldTags.length + newTags.length).toString();
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function initHeadManager() {
|
|
156
|
+
return {
|
|
157
|
+
mountedInstances: /* @__PURE__ */ new Set(),
|
|
158
|
+
updateHead: (head) => {
|
|
159
|
+
const tags = {};
|
|
160
|
+
head.forEach((h) => {
|
|
161
|
+
if (
|
|
162
|
+
// If the font tag is loaded only on client navigation
|
|
163
|
+
// it won't be inlined. In this case revert to the original behavior
|
|
164
|
+
h.type === "link" && h.props["data-optimized-fonts"]
|
|
165
|
+
) {
|
|
166
|
+
if (document.querySelector('style[data-href="' + h.props["data-href"] + '"]')) {
|
|
167
|
+
return;
|
|
168
|
+
} else {
|
|
169
|
+
h.props.href = h.props["data-href"];
|
|
170
|
+
h.props["data-href"] = void 0;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
const components = tags[h.type] || [];
|
|
174
|
+
components.push(h);
|
|
175
|
+
tags[h.type] = components;
|
|
176
|
+
});
|
|
177
|
+
const titleComponent = tags.title ? tags.title[0] : null;
|
|
178
|
+
let title = "";
|
|
179
|
+
if (titleComponent) {
|
|
180
|
+
const { children } = titleComponent.props;
|
|
181
|
+
title = typeof children === "string" ? children : Array.isArray(children) ? children.join("") : "";
|
|
182
|
+
}
|
|
183
|
+
if (title !== document.title) document.title = title;
|
|
184
|
+
[
|
|
185
|
+
"meta",
|
|
186
|
+
"base",
|
|
187
|
+
"link",
|
|
188
|
+
"style",
|
|
189
|
+
"script"
|
|
190
|
+
].forEach((type) => {
|
|
191
|
+
updateElements(type, tags[type] || []);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
if ((typeof exports$1.default === "function" || typeof exports$1.default === "object" && exports$1.default !== null) && typeof exports$1.default.__esModule === "undefined") {
|
|
197
|
+
Object.defineProperty(exports$1.default, "__esModule", { value: true });
|
|
198
|
+
Object.assign(exports$1.default, exports$1);
|
|
199
|
+
module.exports = exports$1.default;
|
|
200
|
+
}
|
|
201
|
+
})(headManager, headManager.exports);
|
|
202
|
+
return headManager.exports;
|
|
203
|
+
}
|
|
204
|
+
export {
|
|
205
|
+
requireHeadManager as __require
|
|
206
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { __module as requestIdleCallback } from "../../../../_virtual/request-idle-callback.js";
|
|
2
|
+
var hasRequiredRequestIdleCallback;
|
|
3
|
+
function requireRequestIdleCallback() {
|
|
4
|
+
if (hasRequiredRequestIdleCallback) return requestIdleCallback.exports;
|
|
5
|
+
hasRequiredRequestIdleCallback = 1;
|
|
6
|
+
(function(module, exports$1) {
|
|
7
|
+
Object.defineProperty(exports$1, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
function _export(target, all) {
|
|
11
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: all[name]
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
_export(exports$1, {
|
|
17
|
+
cancelIdleCallback: function() {
|
|
18
|
+
return cancelIdleCallback;
|
|
19
|
+
},
|
|
20
|
+
requestIdleCallback: function() {
|
|
21
|
+
return requestIdleCallback2;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const requestIdleCallback2 = typeof self !== "undefined" && self.requestIdleCallback && self.requestIdleCallback.bind(window) || function(cb) {
|
|
25
|
+
let start = Date.now();
|
|
26
|
+
return self.setTimeout(function() {
|
|
27
|
+
cb({
|
|
28
|
+
didTimeout: false,
|
|
29
|
+
timeRemaining: function() {
|
|
30
|
+
return Math.max(0, 50 - (Date.now() - start));
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}, 1);
|
|
34
|
+
};
|
|
35
|
+
const cancelIdleCallback = typeof self !== "undefined" && self.cancelIdleCallback && self.cancelIdleCallback.bind(window) || function(id) {
|
|
36
|
+
return clearTimeout(id);
|
|
37
|
+
};
|
|
38
|
+
if ((typeof exports$1.default === "function" || typeof exports$1.default === "object" && exports$1.default !== null) && typeof exports$1.default.__esModule === "undefined") {
|
|
39
|
+
Object.defineProperty(exports$1.default, "__esModule", { value: true });
|
|
40
|
+
Object.assign(exports$1.default, exports$1);
|
|
41
|
+
module.exports = exports$1.default;
|
|
42
|
+
}
|
|
43
|
+
})(requestIdleCallback, requestIdleCallback.exports);
|
|
44
|
+
return requestIdleCallback.exports;
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
requireRequestIdleCallback as __require
|
|
48
|
+
};
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { __module as script } from "../../../../_virtual/script.js";
|
|
2
|
+
import "../../../@swc/helpers/cjs/_interop_require_default.js";
|
|
3
|
+
import "../../../@swc/helpers/cjs/_interop_require_wildcard.js";
|
|
4
|
+
import require$$2 from "react/jsx-runtime";
|
|
5
|
+
import ReactDOM from "react-dom";
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { __require as requireHeadManagerContext_sharedRuntime } from "../shared/lib/head-manager-context.shared-runtime.js";
|
|
8
|
+
import { __require as requireHeadManager } from "./head-manager.js";
|
|
9
|
+
import { __require as requireRequestIdleCallback } from "./request-idle-callback.js";
|
|
10
|
+
import { __exports as _interop_require_wildcard } from "../../../../_virtual/_interop_require_wildcard.js";
|
|
11
|
+
import { __exports as _interop_require_default } from "../../../../_virtual/_interop_require_default.js";
|
|
12
|
+
(function(module, exports$1) {
|
|
13
|
+
"use client";
|
|
14
|
+
Object.defineProperty(exports$1, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for (var name in all) Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: all[name]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports$1, {
|
|
24
|
+
default: function() {
|
|
25
|
+
return _default;
|
|
26
|
+
},
|
|
27
|
+
handleClientScriptLoad: function() {
|
|
28
|
+
return handleClientScriptLoad;
|
|
29
|
+
},
|
|
30
|
+
initScriptLoader: function() {
|
|
31
|
+
return initScriptLoader;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const _interop_require_default$1 = _interop_require_default;
|
|
35
|
+
const _interop_require_wildcard$1 = _interop_require_wildcard;
|
|
36
|
+
const _jsxruntime = require$$2;
|
|
37
|
+
const _reactdom = /* @__PURE__ */ _interop_require_default$1._(ReactDOM);
|
|
38
|
+
const _react = /* @__PURE__ */ _interop_require_wildcard$1._(React);
|
|
39
|
+
const _headmanagercontextsharedruntime = requireHeadManagerContext_sharedRuntime();
|
|
40
|
+
const _headmanager = requireHeadManager();
|
|
41
|
+
const _requestidlecallback = requireRequestIdleCallback();
|
|
42
|
+
const ScriptCache = /* @__PURE__ */ new Map();
|
|
43
|
+
const LoadCache = /* @__PURE__ */ new Set();
|
|
44
|
+
const ignoreProps = [
|
|
45
|
+
"onLoad",
|
|
46
|
+
"onReady",
|
|
47
|
+
"dangerouslySetInnerHTML",
|
|
48
|
+
"children",
|
|
49
|
+
"onError",
|
|
50
|
+
"strategy",
|
|
51
|
+
"stylesheets"
|
|
52
|
+
];
|
|
53
|
+
const insertStylesheets = (stylesheets) => {
|
|
54
|
+
if (_reactdom.default.preinit) {
|
|
55
|
+
stylesheets.forEach((stylesheet) => {
|
|
56
|
+
_reactdom.default.preinit(stylesheet, {
|
|
57
|
+
as: "style"
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (typeof window !== "undefined") {
|
|
63
|
+
let head = document.head;
|
|
64
|
+
stylesheets.forEach((stylesheet) => {
|
|
65
|
+
let link = document.createElement("link");
|
|
66
|
+
link.type = "text/css";
|
|
67
|
+
link.rel = "stylesheet";
|
|
68
|
+
link.href = stylesheet;
|
|
69
|
+
head.appendChild(link);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const loadScript = (props) => {
|
|
74
|
+
const { src, id, onLoad = () => {
|
|
75
|
+
}, onReady = null, dangerouslySetInnerHTML, children = "", strategy = "afterInteractive", onError, stylesheets } = props;
|
|
76
|
+
const cacheKey = id || src;
|
|
77
|
+
if (cacheKey && LoadCache.has(cacheKey)) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (ScriptCache.has(src)) {
|
|
81
|
+
LoadCache.add(cacheKey);
|
|
82
|
+
ScriptCache.get(src).then(onLoad, onError);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const afterLoad = () => {
|
|
86
|
+
if (onReady) {
|
|
87
|
+
onReady();
|
|
88
|
+
}
|
|
89
|
+
LoadCache.add(cacheKey);
|
|
90
|
+
};
|
|
91
|
+
const el = document.createElement("script");
|
|
92
|
+
const loadPromise = new Promise((resolve, reject) => {
|
|
93
|
+
el.addEventListener("load", function(e) {
|
|
94
|
+
resolve();
|
|
95
|
+
if (onLoad) {
|
|
96
|
+
onLoad.call(this, e);
|
|
97
|
+
}
|
|
98
|
+
afterLoad();
|
|
99
|
+
});
|
|
100
|
+
el.addEventListener("error", function(e) {
|
|
101
|
+
reject(e);
|
|
102
|
+
});
|
|
103
|
+
}).catch(function(e) {
|
|
104
|
+
if (onError) {
|
|
105
|
+
onError(e);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
if (dangerouslySetInnerHTML) {
|
|
109
|
+
el.innerHTML = dangerouslySetInnerHTML.__html || "";
|
|
110
|
+
afterLoad();
|
|
111
|
+
} else if (children) {
|
|
112
|
+
el.textContent = typeof children === "string" ? children : Array.isArray(children) ? children.join("") : "";
|
|
113
|
+
afterLoad();
|
|
114
|
+
} else if (src) {
|
|
115
|
+
el.src = src;
|
|
116
|
+
ScriptCache.set(src, loadPromise);
|
|
117
|
+
}
|
|
118
|
+
for (const [k, value] of Object.entries(props)) {
|
|
119
|
+
if (value === void 0 || ignoreProps.includes(k)) {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
const attr = _headmanager.DOMAttributeNames[k] || k.toLowerCase();
|
|
123
|
+
el.setAttribute(attr, value);
|
|
124
|
+
}
|
|
125
|
+
if (strategy === "worker") {
|
|
126
|
+
el.setAttribute("type", "text/partytown");
|
|
127
|
+
}
|
|
128
|
+
el.setAttribute("data-nscript", strategy);
|
|
129
|
+
if (stylesheets) {
|
|
130
|
+
insertStylesheets(stylesheets);
|
|
131
|
+
}
|
|
132
|
+
document.body.appendChild(el);
|
|
133
|
+
};
|
|
134
|
+
function handleClientScriptLoad(props) {
|
|
135
|
+
const { strategy = "afterInteractive" } = props;
|
|
136
|
+
if (strategy === "lazyOnload") {
|
|
137
|
+
window.addEventListener("load", () => {
|
|
138
|
+
(0, _requestidlecallback.requestIdleCallback)(() => loadScript(props));
|
|
139
|
+
});
|
|
140
|
+
} else {
|
|
141
|
+
loadScript(props);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function loadLazyScript(props) {
|
|
145
|
+
if (document.readyState === "complete") {
|
|
146
|
+
(0, _requestidlecallback.requestIdleCallback)(() => loadScript(props));
|
|
147
|
+
} else {
|
|
148
|
+
window.addEventListener("load", () => {
|
|
149
|
+
(0, _requestidlecallback.requestIdleCallback)(() => loadScript(props));
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function addBeforeInteractiveToCache() {
|
|
154
|
+
const scripts = [
|
|
155
|
+
...document.querySelectorAll('[data-nscript="beforeInteractive"]'),
|
|
156
|
+
...document.querySelectorAll('[data-nscript="beforePageRender"]')
|
|
157
|
+
];
|
|
158
|
+
scripts.forEach((script2) => {
|
|
159
|
+
const cacheKey = script2.id || script2.getAttribute("src");
|
|
160
|
+
LoadCache.add(cacheKey);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function initScriptLoader(scriptLoaderItems) {
|
|
164
|
+
scriptLoaderItems.forEach(handleClientScriptLoad);
|
|
165
|
+
addBeforeInteractiveToCache();
|
|
166
|
+
}
|
|
167
|
+
function Script(props) {
|
|
168
|
+
const { id, src = "", onLoad = () => {
|
|
169
|
+
}, onReady = null, strategy = "afterInteractive", onError, stylesheets, ...restProps } = props;
|
|
170
|
+
const { updateScripts, scripts, getIsSsr, appDir, nonce } = (0, _react.useContext)(_headmanagercontextsharedruntime.HeadManagerContext);
|
|
171
|
+
const hasOnReadyEffectCalled = (0, _react.useRef)(false);
|
|
172
|
+
(0, _react.useEffect)(() => {
|
|
173
|
+
const cacheKey = id || src;
|
|
174
|
+
if (!hasOnReadyEffectCalled.current) {
|
|
175
|
+
if (onReady && cacheKey && LoadCache.has(cacheKey)) {
|
|
176
|
+
onReady();
|
|
177
|
+
}
|
|
178
|
+
hasOnReadyEffectCalled.current = true;
|
|
179
|
+
}
|
|
180
|
+
}, [
|
|
181
|
+
onReady,
|
|
182
|
+
id,
|
|
183
|
+
src
|
|
184
|
+
]);
|
|
185
|
+
const hasLoadScriptEffectCalled = (0, _react.useRef)(false);
|
|
186
|
+
(0, _react.useEffect)(() => {
|
|
187
|
+
if (!hasLoadScriptEffectCalled.current) {
|
|
188
|
+
if (strategy === "afterInteractive") {
|
|
189
|
+
loadScript(props);
|
|
190
|
+
} else if (strategy === "lazyOnload") {
|
|
191
|
+
loadLazyScript(props);
|
|
192
|
+
}
|
|
193
|
+
hasLoadScriptEffectCalled.current = true;
|
|
194
|
+
}
|
|
195
|
+
}, [
|
|
196
|
+
props,
|
|
197
|
+
strategy
|
|
198
|
+
]);
|
|
199
|
+
if (strategy === "beforeInteractive" || strategy === "worker") {
|
|
200
|
+
if (updateScripts) {
|
|
201
|
+
scripts[strategy] = (scripts[strategy] || []).concat([
|
|
202
|
+
{
|
|
203
|
+
id,
|
|
204
|
+
src,
|
|
205
|
+
onLoad,
|
|
206
|
+
onReady,
|
|
207
|
+
onError,
|
|
208
|
+
...restProps
|
|
209
|
+
}
|
|
210
|
+
]);
|
|
211
|
+
updateScripts(scripts);
|
|
212
|
+
} else if (getIsSsr && getIsSsr()) {
|
|
213
|
+
LoadCache.add(id || src);
|
|
214
|
+
} else if (getIsSsr && !getIsSsr()) {
|
|
215
|
+
loadScript(props);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if (appDir) {
|
|
219
|
+
if (stylesheets) {
|
|
220
|
+
stylesheets.forEach((styleSrc) => {
|
|
221
|
+
_reactdom.default.preinit(styleSrc, {
|
|
222
|
+
as: "style"
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
if (strategy === "beforeInteractive") {
|
|
227
|
+
if (!src) {
|
|
228
|
+
if (restProps.dangerouslySetInnerHTML) {
|
|
229
|
+
restProps.children = restProps.dangerouslySetInnerHTML.__html;
|
|
230
|
+
delete restProps.dangerouslySetInnerHTML;
|
|
231
|
+
}
|
|
232
|
+
return /* @__PURE__ */ (0, _jsxruntime.jsx)("script", {
|
|
233
|
+
nonce,
|
|
234
|
+
dangerouslySetInnerHTML: {
|
|
235
|
+
__html: "(self.__next_s=self.__next_s||[]).push(" + JSON.stringify([
|
|
236
|
+
0,
|
|
237
|
+
{
|
|
238
|
+
...restProps,
|
|
239
|
+
id
|
|
240
|
+
}
|
|
241
|
+
]) + ")"
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
} else {
|
|
245
|
+
_reactdom.default.preload(src, restProps.integrity ? {
|
|
246
|
+
as: "script",
|
|
247
|
+
integrity: restProps.integrity,
|
|
248
|
+
nonce,
|
|
249
|
+
crossOrigin: restProps.crossOrigin
|
|
250
|
+
} : {
|
|
251
|
+
as: "script",
|
|
252
|
+
nonce,
|
|
253
|
+
crossOrigin: restProps.crossOrigin
|
|
254
|
+
});
|
|
255
|
+
return /* @__PURE__ */ (0, _jsxruntime.jsx)("script", {
|
|
256
|
+
nonce,
|
|
257
|
+
dangerouslySetInnerHTML: {
|
|
258
|
+
__html: "(self.__next_s=self.__next_s||[]).push(" + JSON.stringify([
|
|
259
|
+
src,
|
|
260
|
+
{
|
|
261
|
+
...restProps,
|
|
262
|
+
id
|
|
263
|
+
}
|
|
264
|
+
]) + ")"
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
} else if (strategy === "afterInteractive") {
|
|
269
|
+
if (src) {
|
|
270
|
+
_reactdom.default.preload(src, restProps.integrity ? {
|
|
271
|
+
as: "script",
|
|
272
|
+
integrity: restProps.integrity,
|
|
273
|
+
nonce,
|
|
274
|
+
crossOrigin: restProps.crossOrigin
|
|
275
|
+
} : {
|
|
276
|
+
as: "script",
|
|
277
|
+
nonce,
|
|
278
|
+
crossOrigin: restProps.crossOrigin
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
Object.defineProperty(Script, "__nextScript", {
|
|
286
|
+
value: true
|
|
287
|
+
});
|
|
288
|
+
const _default = Script;
|
|
289
|
+
if ((typeof exports$1.default === "function" || typeof exports$1.default === "object" && exports$1.default !== null) && typeof exports$1.default.__esModule === "undefined") {
|
|
290
|
+
Object.defineProperty(exports$1.default, "__esModule", { value: true });
|
|
291
|
+
Object.assign(exports$1.default, exports$1);
|
|
292
|
+
module.exports = exports$1.default;
|
|
293
|
+
}
|
|
294
|
+
})(script, script.exports);
|
|
295
|
+
var scriptExports = script.exports;
|
|
296
|
+
export {
|
|
297
|
+
scriptExports as s
|
|
298
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { __exports as headManagerContext_sharedRuntime } from "../../../../../_virtual/head-manager-context.shared-runtime.js";
|
|
2
|
+
import "../../../../@swc/helpers/cjs/_interop_require_default.js";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { __exports as _interop_require_default } from "../../../../../_virtual/_interop_require_default.js";
|
|
5
|
+
var hasRequiredHeadManagerContext_sharedRuntime;
|
|
6
|
+
function requireHeadManagerContext_sharedRuntime() {
|
|
7
|
+
if (hasRequiredHeadManagerContext_sharedRuntime) return headManagerContext_sharedRuntime;
|
|
8
|
+
hasRequiredHeadManagerContext_sharedRuntime = 1;
|
|
9
|
+
(function(exports$1) {
|
|
10
|
+
Object.defineProperty(exports$1, "__esModule", {
|
|
11
|
+
value: true
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports$1, "HeadManagerContext", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function() {
|
|
16
|
+
return HeadManagerContext;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _interop_require_default$1 = _interop_require_default;
|
|
20
|
+
const _react = /* @__PURE__ */ _interop_require_default$1._(React);
|
|
21
|
+
const HeadManagerContext = _react.default.createContext({});
|
|
22
|
+
if (process.env.NODE_ENV !== "production") {
|
|
23
|
+
HeadManagerContext.displayName = "HeadManagerContext";
|
|
24
|
+
}
|
|
25
|
+
})(headManagerContext_sharedRuntime);
|
|
26
|
+
return headManagerContext_sharedRuntime;
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
requireHeadManagerContext_sharedRuntime as __require
|
|
30
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { getDefaultExportFromCjs } from "../../_virtual/_commonjsHelpers.js";
|
|
2
|
+
import { s as scriptExports } from "./dist/client/script.js";
|
|
3
|
+
var script = scriptExports;
|
|
4
|
+
const Script = /* @__PURE__ */ getDefaultExportFromCjs(script);
|
|
5
|
+
export {
|
|
6
|
+
Script as default
|
|
7
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import Script from "../node_modules/next/script.js";
|
|
3
|
+
import { getImportMapScriptProps } from "./ImportMapService.js";
|
|
4
|
+
const ImportMapScript = ({
|
|
5
|
+
reactVersion,
|
|
6
|
+
reactDomVersion,
|
|
7
|
+
customImports,
|
|
8
|
+
strategy = "beforeInteractive"
|
|
9
|
+
}) => {
|
|
10
|
+
const scriptProps = getImportMapScriptProps({
|
|
11
|
+
reactVersion,
|
|
12
|
+
reactDomVersion,
|
|
13
|
+
customImports
|
|
14
|
+
});
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
Script,
|
|
17
|
+
{
|
|
18
|
+
id: "remote-components-import-map",
|
|
19
|
+
strategy,
|
|
20
|
+
...scriptProps
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
ImportMapScript
|
|
26
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import packageJson from "../packages/shared-utils/package.json.js";
|
|
2
|
+
const cleanVersion = (version) => {
|
|
3
|
+
return version.replace(/^[\^~]/, "");
|
|
4
|
+
};
|
|
5
|
+
const DEFAULT_CONFIG = {
|
|
6
|
+
reactVersion: cleanVersion(packageJson.dependencies.react),
|
|
7
|
+
reactDomVersion: cleanVersion(packageJson.dependencies["react-dom"])
|
|
8
|
+
};
|
|
9
|
+
const generateReactDataUrl = () => {
|
|
10
|
+
return `data:text/javascript;charset=utf-8,
|
|
11
|
+
const React = window.React;
|
|
12
|
+
export default React;
|
|
13
|
+
export const {
|
|
14
|
+
Component, PureComponent, createContext, useContext, useState, useEffect,
|
|
15
|
+
useCallback, useMemo, useRef, forwardRef, createElement, Fragment, memo, lazy, Suspense,
|
|
16
|
+
useLayoutEffect, useId
|
|
17
|
+
} = React;`;
|
|
18
|
+
};
|
|
19
|
+
const generateJsxRuntimeDataUrl = () => {
|
|
20
|
+
return `data:text/javascript;charset=utf-8,
|
|
21
|
+
import * as ReactJSXRuntime from 'https://esm.sh/react@18.3.1/jsx-runtime';
|
|
22
|
+
export const jsx = ReactJSXRuntime.jsx;
|
|
23
|
+
export const jsxs = ReactJSXRuntime.jsxs;
|
|
24
|
+
export const Fragment = ReactJSXRuntime.Fragment;`;
|
|
25
|
+
};
|
|
26
|
+
const generateImportMap = (config = {}) => {
|
|
27
|
+
const finalConfig = { ...DEFAULT_CONFIG, ...config };
|
|
28
|
+
return {
|
|
29
|
+
imports: {
|
|
30
|
+
react: generateReactDataUrl(),
|
|
31
|
+
"react/jsx-runtime": generateJsxRuntimeDataUrl(),
|
|
32
|
+
"react/jsx-dev-runtime": generateJsxRuntimeDataUrl(),
|
|
33
|
+
// Some bundlers emit ".js" suffixed bare specifiers; map those too
|
|
34
|
+
"react/jsx-runtime.js": generateJsxRuntimeDataUrl(),
|
|
35
|
+
"react/jsx-dev-runtime.js": generateJsxRuntimeDataUrl(),
|
|
36
|
+
"react-dom": `https://esm.sh/react-dom@${finalConfig.reactDomVersion}`,
|
|
37
|
+
"react-dom/client": `https://esm.sh/react-dom@${finalConfig.reactDomVersion}/client`
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
const generateImportMapJson = (config) => {
|
|
42
|
+
return JSON.stringify(generateImportMap(config));
|
|
43
|
+
};
|
|
44
|
+
const isImportMapSupported = () => {
|
|
45
|
+
if (typeof window === "undefined") return false;
|
|
46
|
+
return "importmap" in document.createElement("script");
|
|
47
|
+
};
|
|
48
|
+
const getImportMapScriptProps = (config) => {
|
|
49
|
+
return {
|
|
50
|
+
type: "importmap-shim",
|
|
51
|
+
dangerouslySetInnerHTML: {
|
|
52
|
+
__html: generateImportMapJson(config)
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
generateImportMap,
|
|
58
|
+
generateImportMapJson,
|
|
59
|
+
getImportMapScriptProps,
|
|
60
|
+
isImportMapSupported
|
|
61
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaena1/mm-ui-shared-utils",
|
|
3
|
-
"version": "1.25.0-f-poc-EC-3301.
|
|
3
|
+
"version": "1.25.0-f-poc-EC-3301.3",
|
|
4
4
|
"description": "Shared utilities for loading remote React components in Mint Mobile microfrontends",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -35,6 +35,10 @@
|
|
|
35
35
|
],
|
|
36
36
|
"author": "",
|
|
37
37
|
"license": "ISC",
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"react": "^18.3.1",
|
|
40
|
+
"react-dom": "^18.3.1"
|
|
41
|
+
},
|
|
38
42
|
"peerDependencies": {
|
|
39
43
|
"react": "^18.3.1",
|
|
40
44
|
"react-dom": "^18.3.1"
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
function generateImportMapJson() {
|
|
2
|
-
const importMap = {
|
|
3
|
-
imports: {
|
|
4
|
-
react: "react",
|
|
5
|
-
"react-dom": "react-dom",
|
|
6
|
-
"react/jsx-runtime": "react/jsx-runtime",
|
|
7
|
-
"react/jsx-dev-runtime": "react/jsx-dev-runtime"
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
return JSON.stringify(importMap);
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
generateImportMapJson
|
|
14
|
-
};
|