@agrotools1/at-mf-utils 0.3.2 → 0.4.1

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.
@@ -1,4 +1,4 @@
1
- declare type IResponse = {
1
+ type IResponse = {
2
2
  mount: (tag: string, props?: Record<string, any>) => void;
3
3
  unmount: () => void;
4
4
  asyncComponents: Record<string, any>;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import getModule from './build';
1
+ import { default as getModule } from './build';
2
2
  export { getModule };
package/dist/index.js CHANGED
@@ -1 +1,48 @@
1
- import o from"./build";export{o as getModule};
1
+ function m() {
2
+ const t = document.querySelectorAll('link[from="athost"]');
3
+ for (let n = 0; n < t.length; n++)
4
+ t[n].remove();
5
+ }
6
+ function d(t, n) {
7
+ const e = document.getElementById(t);
8
+ window[n] = null, e == null || e.remove();
9
+ }
10
+ async function y(t, n) {
11
+ if (!t || !n) return;
12
+ const e = Object.entries(t);
13
+ for (let s = 0; s < e.length; s++) {
14
+ const [r, o] = e[s], c = await o();
15
+ n.appContext.app.component(r, c.default);
16
+ }
17
+ }
18
+ async function p(t, n) {
19
+ return new Promise((e) => {
20
+ m(), d(t, n), e();
21
+ });
22
+ }
23
+ async function g(t, n, e) {
24
+ const s = `remote-entry-${t}`;
25
+ return await p(s, t), await (__webpack_init_sharing__ == null ? void 0 : __webpack_init_sharing__("default")), new Promise((r) => {
26
+ const o = document.createElement("script");
27
+ o.type = "text/javascript", o.src = n, o.defer = !0, o.async = !0, o.id = s, document.head.appendChild(o), o.onload = async () => {
28
+ var _;
29
+ const c = window[t], i = typeof __webpack_share_scopes__ < "u" ? __webpack_share_scopes__ : null;
30
+ await (c == null ? void 0 : c.init(i == null ? void 0 : i.default));
31
+ const u = await (await ((_ = c.get) == null ? void 0 : _.call(c, t)))().default, a = u == null ? void 0 : u.default;
32
+ y(a.asyncComponents, e);
33
+ const f = {
34
+ ...a || {},
35
+ defaultImport: a,
36
+ unmount: async () => {
37
+ a == null || a.unmount(), p(s, t);
38
+ const l = document.getElementById("agrotools-app");
39
+ l == null || l.remove();
40
+ }
41
+ };
42
+ r(f);
43
+ };
44
+ });
45
+ }
46
+ export {
47
+ g as getModule
48
+ };
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@agrotools1/at-mf-utils",
3
3
  "type": "module",
4
- "version": "0.3.2",
4
+ "version": "0.4.1",
5
5
  "private": false,
6
- "packageManager": "pnpm@9.1.0",
7
6
  "description": "Métodos utilitários de MF da Agrotools",
8
7
  "author": "Agrotools",
9
8
  "license": "MIT",
@@ -12,27 +11,13 @@
12
11
  "mf",
13
12
  "agrotools"
14
13
  ],
15
- "main": "./dist/index.js",
16
- "module": "./dist/index.js",
17
- "types": "./dist/index.d.ts",
18
- "typings": "./dist/index.d.ts",
14
+ "main": "dist/index.js",
15
+ "module": "dist/index.js",
16
+ "types": "dist/index.d.ts",
19
17
  "files": [
20
18
  "dist"
21
19
  ],
22
- "devDependencies": {
23
- "esbuild": "0.24.0",
24
- "esbuild-plugin-tsc": "0.4.0",
25
- "glob": "11.0.0",
26
- "typescript": "4.2.4",
27
- "webpack": "^5.93.0"
28
- },
29
20
  "publishConfig": {
30
21
  "access": "public"
31
- },
32
- "scripts": {
33
- "build": "pnpm run build-only",
34
- "build-only": "node ./scripts/build.js && tsc --emitDeclarationOnly",
35
- "format": "prettier --write src/",
36
- "pub:release": "pnpm publish --access public"
37
22
  }
38
- }
23
+ }
File without changes
@@ -1 +0,0 @@
1
- function l(){const e=document.querySelectorAll('link[from="athost"]');for(let n=0;n<e.length;n++)e[n].remove()}function d(e,n){const o=document.getElementById(e);window[n]=null,o?.remove()}async function m(e,n){if(!e||!n)return;const o=Object.entries(e);for(let s=0;s<o.length;s++){const[i,t]=o[s],r=await t();n.appContext.app.component(i,r.default)}}async function c(e,n){return new Promise(o=>{l(),d(e,n),o()})}async function f(e,n,o){const s=`remote-entry-${e}`;return await c(s,e),await __webpack_init_sharing__?.("default"),new Promise(i=>{const t=document.createElement("script");t.type="text/javascript",t.src=n,t.defer=!0,t.async=!0,t.id=s,document.head.appendChild(t),t.onload=async()=>{const r=window[e],p=typeof __webpack_share_scopes__<"u"?__webpack_share_scopes__:null;await r?.init(p?.default);const a=(await(await r.get?.(e))().default)?.default;m(a.asyncComponents,o);const u={...a||{},defaultImport:a,unmount:async()=>{a?.unmount(),c(s,e),document.getElementById("agrotools-app")?.remove()}};i(u)}})}export{f as default};