@feedmepos/mf-common 1.6.4 → 1.6.6-rc.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.
@@ -6,5 +6,5 @@ export interface FmmfPresentOptions {
6
6
  importMapScopes?: Record<string, string>;
7
7
  isDev?: boolean;
8
8
  }
9
- export declare const fmmfVitePresent: (config: UserConfig, { command, mode }: ConfigEnv, options?: FmmfPresentOptions) => UserConfig;
9
+ export declare const fmmfVitePresent: (config: UserConfig, { command, mode }: ConfigEnv, options?: FmmfPresentOptions) => Promise<UserConfig>;
10
10
  //# sourceMappingURL=vite-preset.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vite-preset.d.ts","sourceRoot":"","sources":["../vite-preset.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAwB,UAAU,EAAE,MAAM,MAAM,CAAA;AAKvE,MAAM,WAAW,kBAAkB;IACjC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC9B,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5C,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxC,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,eAAO,MAAM,eAAe,WAClB,UAAU,qBACC,SAAS,YACnB,kBAAkB,KAC1B,UAmHF,CAAA"}
1
+ {"version":3,"file":"vite-preset.d.ts","sourceRoot":"","sources":["../vite-preset.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAwB,UAAU,EAAE,MAAM,MAAM,CAAA;AAMvE,MAAM,WAAW,kBAAkB;IACjC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC9B,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5C,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxC,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,eAAO,MAAM,eAAe,WAClB,UAAU,qBACC,SAAS,YACnB,kBAAkB,KAC1B,QAAQ,UAAU,CAiIpB,CAAA"}
@@ -1,143 +1,16 @@
1
- import { resolve as h } from "path";
2
- import { readFileSync as v } from "fs";
3
- const b = (l) => {
4
- const r = l.join("|");
5
- return new RegExp(`^(${r})(\\/.*)?$`);
6
- }, j = ({
7
- externals: l
8
- }) => {
9
- const r = b(l);
10
- return {
11
- name: "externalize",
12
- setup(e) {
13
- e.onResolve({ filter: r }, (t) => ({
14
- path: t.path,
15
- namespace: "externalize"
16
- })), e.onLoad({ filter: r }, () => ({
17
- contents: ""
18
- }));
19
- }
20
- };
21
- }, O = (l) => {
22
- const r = "/@id/", e = new RegExp(
23
- `${r}(${l.join("|")})`,
24
- "g"
25
- );
26
- return {
27
- name: "vite-plugin-remove-prefix",
28
- transform: (t) => e.test(t) ? t.replace(
29
- e,
30
- (p, c) => c
31
- ) : t
32
- };
33
- }, z = (l) => {
34
- const { externals: r } = l;
35
- return {
36
- name: "vite-plugin-externalize",
37
- enforce: "pre",
38
- apply: "serve",
39
- config: (e) => {
40
- var t;
41
- const p = { ...e };
42
- return p.optimizeDeps && p.optimizeDeps.esbuildOptions && ((t = p.optimizeDeps.esbuildOptions).plugins ?? (t.plugins = []), p.optimizeDeps.esbuildOptions.plugins.push(
43
- j({ externals: r })
44
- )), p;
45
- },
46
- configResolved: (e) => {
47
- if (e.optimizeDeps && e.optimizeDeps.include) {
48
- const p = e.optimizeDeps.include.filter(
49
- (c) => !r.includes(c)
50
- );
51
- e.optimizeDeps.include = p;
52
- }
53
- e.optimizeDeps && (e.optimizeDeps.exclude = e.optimizeDeps.exclude || [], e.optimizeDeps.exclude.push(...r));
54
- const t = O(r);
55
- e.plugins.push(t);
56
- },
57
- // Supresses the following warning:
58
- // Failed to resolve import [dependency] from [sourceFile]. Does the file exist?
59
- resolveId: (e) => r.includes(e) ? { id: e, external: !0 } : null,
60
- // Supresses the following warning:
61
- // The following dependencies are imported but could not be resolved:
62
- // [dependency] (imported by [sourceFile])
63
- load: (e) => r.includes(e) ? "export default {};" : null
64
- };
65
- }, D = "@feedmepos/mf-", P = (l, { command: r, mode: e }, t = {}) => {
66
- var m, d, f, g;
67
- const p = JSON.parse(
68
- v(h(process.cwd(), "package.json"), "utf-8")
69
- ), c = Object.keys(p.dependencies).filter((s) => s.startsWith(D)).reduce((s, i) => (s[i] = p.dependencies[i], s), {});
70
- (m = t.includeFmmfPackages) == null || m.forEach((s) => {
71
- c[s] = p.dependencies[s] ?? "latest";
72
- }), (d = t.excludeFmmfPackages) == null || d.forEach((s) => {
73
- delete c[s];
74
- });
75
- const o = {
76
- "@vue/devtools-api": "6.5.0/lib/esm/index.js",
77
- vue: "3.4.27/dist/vue.esm-browser.prod.min.js",
78
- "vue-router": "4.2.5/dist/vue-router.esm-browser.min.js",
79
- pinia: "2.1.7/+esm"
80
- };
81
- let a = [...Object.keys(o), ...Object.keys(c)];
82
- const n = { ...l };
83
- r == "build" && e.startsWith("fmmf") && (a = [...Object.keys(c), ...Object.keys(o)], n.build = {
84
- emptyOutDir: !0,
85
- lib: {
86
- entry: {
87
- app: h(process.cwd(), "src/app.ts")
88
- },
89
- formats: ["es"]
90
- },
91
- rollupOptions: {
92
- external: a
93
- }
94
- }), n.plugins ?? (n.plugins = []), n.plugins.push(z({ externals: a })), n.build ?? (n.build = {}), (f = n.build).rollupOptions ?? (f.rollupOptions = {}), (g = n.build.rollupOptions).external ?? (g.external = a);
95
- const u = {
96
- imports: {
97
- ...Object.keys(c).reduce((s, i) => (s[i] = `https://cdn.jsdelivr.net/npm/${i}@${t.isDev ? "latest" : "beta"}/dist/app.js`, s), {}),
98
- ...Object.keys(o).reduce((s, i) => (s[i] = `https://cdn.jsdelivr.net/npm/${i}@${o[i]}`, s), {})
99
- },
100
- scopes: t.importMapScopes ?? {}
101
- };
102
- t.replaceFmmfPackages && Object.entries(t.replaceFmmfPackages).forEach(([s, i]) => {
103
- if (s.startsWith("@feedmepos/mf-") || s === "@feedmepos/ui-library")
104
- u.imports[s] = i;
105
- else
106
- throw new Error(`Invalid replaceFmmfPackages key: ${s}, must start with @feedmepos/mf-`);
107
- });
108
- const x = {
109
- name: "vite-plugin-feedme-microfrontend",
110
- enforce: "pre",
111
- config: async () => {
112
- },
113
- transformIndexHtml: {
114
- enforce: "pre",
115
- transform(s) {
116
- return {
117
- html: s,
118
- tags: [
119
- {
120
- tag: "script",
121
- attrs: {
122
- type: "importmap"
123
- },
124
- children: JSON.stringify(u, null, 2),
125
- injectTo: "head-prepend"
126
- },
127
- {
128
- tag: "script",
129
- attrs: {
130
- src: "https://cdn.jsdelivr.net/npm/es-module-shims@1.8.0/dist/es-module-shims.min.js"
131
- },
132
- injectTo: "head-prepend"
133
- }
134
- ]
135
- };
136
- }
137
- }
138
- };
139
- return n.plugins.push(x), n;
140
- };
1
+ import "path";
2
+ import "fs";
3
+ import { f as b } from "./vite-preset-1fc4fac1.js";
4
+ import "node:http";
5
+ import "node:https";
6
+ import "node:zlib";
7
+ import "node:stream";
8
+ import "node:buffer";
9
+ import "node:util";
10
+ import "node:url";
11
+ import "node:net";
12
+ import "node:fs";
13
+ import "node:path";
141
14
  export {
142
- P as fmmfVitePresent
15
+ b as fmmfVitePresent
143
16
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-common",
3
- "version": "1.6.4",
3
+ "version": "1.6.6-rc.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -36,6 +36,7 @@
36
36
  "eslint": "^8.49.0",
37
37
  "eslint-plugin-tailwindcss": "^3.14.0",
38
38
  "eslint-plugin-vue": "^9.17.0",
39
+ "node-fetch": "^3.3.2",
39
40
  "npm-run-all2": "^6.0.6",
40
41
  "postcss": "^8.4.31",
41
42
  "prettier": "^3.0.3",