@feedmepos/mf-common 1.28.6 → 1.28.8
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/README.md +0 -9
- package/dist/{CustomAttributesForm-e78f15d5.js → CustomAttributesForm-a255e824.js} +1 -1
- package/dist/{ItemSelector-18dccc18.js → ItemSelector-e9325121.js} +9846 -9635
- package/dist/{RestaurantSelector-0a2d4d60.js → RestaurantSelector-224c2427.js} +55 -55
- package/dist/{app-9b38f0c2.js → app-7ca435b2.js} +8668 -8524
- package/dist/app.js +2 -2
- package/dist/components/Portal/PortalDesktop.vue.d.ts.map +1 -1
- package/dist/components/Portal/PortalMobile.vue.d.ts.map +1 -1
- package/dist/components/Portal/PortalTablet.vue.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/vite-preset.d.ts +88 -0
- package/dist/vite-preset.d.ts.map +1 -1
- package/dist/vite-preset.js +14 -0
- package/package.json +1 -1
package/dist/vite-preset.d.ts
CHANGED
|
@@ -1,12 +1,100 @@
|
|
|
1
1
|
import type { ConfigEnv, UserConfig } from "vite";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration options for the FeedMe Microfrontend (FMMF) Vite preset.
|
|
4
|
+
*
|
|
5
|
+
* This preset configures Vite to work with a microfrontend architecture using ES Module importmaps.
|
|
6
|
+
* It handles externalization of dependencies, CDN imports, and proper bundling for both development
|
|
7
|
+
* and production (fmmf) modes.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* fmmfVitePresent(config, env, {
|
|
12
|
+
* excludeFmmfPackages: ['@feedmepos/mf-old-app'],
|
|
13
|
+
* externalize: true,
|
|
14
|
+
* externalizeCore: true
|
|
15
|
+
* })
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
2
18
|
export interface FmmfPresentOptions {
|
|
19
|
+
/**
|
|
20
|
+
* List of FMMF package names to exclude from the importmap.
|
|
21
|
+
*
|
|
22
|
+
* Use this when you want to bundle a specific microfrontend into your app instead of
|
|
23
|
+
* loading it externally. This only affects your local build; to exclude packages in the
|
|
24
|
+
* portal, contact the project leader.
|
|
25
|
+
*
|
|
26
|
+
* @example ['@feedmepos/mf-old-feature', '@feedmepos/mf-deprecated']
|
|
27
|
+
*/
|
|
3
28
|
excludeFmmfPackages?: string[];
|
|
29
|
+
/**
|
|
30
|
+
* List of additional FMMF package names to include in the importmap.
|
|
31
|
+
*
|
|
32
|
+
* Use this to add microfrontends that aren't in your package.json dependencies but
|
|
33
|
+
* should be available at runtime. This only affects your local build.
|
|
34
|
+
*
|
|
35
|
+
* @example ['@feedmepos/mf-experimental', '@feedmepos/mf-feature-flag']
|
|
36
|
+
*/
|
|
4
37
|
includeFmmfPackages?: string[];
|
|
38
|
+
/**
|
|
39
|
+
* Map of package names to custom CDN URLs to override default jsdelivr CDN.
|
|
40
|
+
*
|
|
41
|
+
* Useful for testing local builds or using different CDN sources. Keys must start with
|
|
42
|
+
* '@feedmepos/mf-' or be '@feedmepos/ui-library'. This only affects your local build.
|
|
43
|
+
*
|
|
44
|
+
* @example { '@feedmepos/mf-menu': 'http://localhost:5173/dist/app.js' }
|
|
45
|
+
* @throws Error if keys don't start with '@feedmepos/mf-' or '@feedmepos/ui-library'
|
|
46
|
+
*/
|
|
5
47
|
replaceFmmfPackages?: Record<string, string>;
|
|
48
|
+
/**
|
|
49
|
+
* Import map scopes for granular control over module resolution in specific contexts.
|
|
50
|
+
*
|
|
51
|
+
* Scopes allow different versions of the same module to be used in different parts of
|
|
52
|
+
* the application. See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap#scopes
|
|
53
|
+
*
|
|
54
|
+
* @example { './local/': { 'vue': 'https://cdn.example.com/vue@3.4.0/dist/vue.esm.js' } }
|
|
55
|
+
*/
|
|
6
56
|
importMapScopes?: Record<string, string>;
|
|
57
|
+
/**
|
|
58
|
+
* Flag indicating development mode. Currently not actively used in the implementation.
|
|
59
|
+
*
|
|
60
|
+
* @deprecated This flag is not currently utilized in the preset logic.
|
|
61
|
+
*/
|
|
7
62
|
isDev?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Controls externalization of microfrontends during development (esbuild phase).
|
|
65
|
+
*
|
|
66
|
+
* When enabled, microfrontend modules won't be bundled but will be loaded from CDN/importmap.
|
|
67
|
+
* This speeds up dev builds but requires proper importmap configuration.
|
|
68
|
+
*
|
|
69
|
+
* - `true`: Externalize all microfrontends and their dependencies
|
|
70
|
+
* - `string[]`: Externalize only specific package names
|
|
71
|
+
* - `false` or undefined: Bundle all dependencies normally
|
|
72
|
+
*
|
|
73
|
+
* @example true // Externalize everything
|
|
74
|
+
* @example ['@feedmepos/mf-menu', 'vue'] // Externalize specific packages
|
|
75
|
+
*/
|
|
8
76
|
externalize?: boolean | string[];
|
|
77
|
+
/**
|
|
78
|
+
* Whether to externalize @feedmepos/core packages (core, core/fn, core/entity, core/modules).
|
|
79
|
+
*
|
|
80
|
+
* When true, core packages are loaded from jsdelivr CDN instead of being bundled.
|
|
81
|
+
* Useful for sharing core logic across multiple microfrontends and reducing bundle size.
|
|
82
|
+
*
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
9
85
|
externalizeCore?: boolean;
|
|
10
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* FeedMe Microfrontend Vite Preset
|
|
89
|
+
*
|
|
90
|
+
* Configures Vite for microfrontend architecture with ES Module importmaps.
|
|
91
|
+
* Handles externalization, CDN imports, and proper bundling for dev and production.
|
|
92
|
+
*
|
|
93
|
+
* @param config - Base Vite configuration to extend
|
|
94
|
+
* @param command - Vite command ('build' or 'serve')
|
|
95
|
+
* @param mode - Build mode (e.g., 'development', 'production', 'fmmf')
|
|
96
|
+
* @param options - FMMF-specific configuration options
|
|
97
|
+
* @returns Modified Vite configuration with microfrontend support
|
|
98
|
+
*/
|
|
11
99
|
export declare const fmmfVitePresent: (config: UserConfig, { command, mode }: ConfigEnv, options?: FmmfPresentOptions) => Promise<UserConfig>;
|
|
12
100
|
//# sourceMappingURL=vite-preset.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-preset.d.ts","sourceRoot":"","sources":["../vite-preset.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAwB,UAAU,EAAE,MAAM,MAAM,CAAA;AAKvE,MAAM,WAAW,kBAAkB;IACjC,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"vite-preset.d.ts","sourceRoot":"","sources":["../vite-preset.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAwB,UAAU,EAAE,MAAM,MAAM,CAAA;AAKvE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;OAQG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAE9B;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAE9B;;;;;;;;OAQG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAE5C;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAExC;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;IAEhC;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,WAClB,UAAU,qBACC,SAAS,YACnB,kBAAkB,KAC1B,QAAQ,UAAU,CAsMpB,CAAA"}
|
package/dist/vite-preset.js
CHANGED
|
@@ -74,6 +74,7 @@ const g = (l) => {
|
|
|
74
74
|
});
|
|
75
75
|
const a = {
|
|
76
76
|
"@feedmepos/ui-library": "https://cdn.jsdelivr.net/npm/@feedmepos/ui-library@latest/dist/feedmepos-ui-library.js",
|
|
77
|
+
// Conditionally externalize core packages to share business logic
|
|
77
78
|
...t.externalizeCore ? {
|
|
78
79
|
"@feedmepos/core": "https://cdn.jsdelivr.net/npm/@feedmepos/core@latest/es/index.js",
|
|
79
80
|
"@feedmepos/core/fn": "https://cdn.jsdelivr.net/npm/@feedmepos/core@latest/es/fn.js",
|
|
@@ -101,8 +102,10 @@ const g = (l) => {
|
|
|
101
102
|
lib: {
|
|
102
103
|
entry: {
|
|
103
104
|
app: h(process.cwd(), "src/app.ts")
|
|
105
|
+
// Entry must export routers, FmApp, etc.
|
|
104
106
|
},
|
|
105
107
|
formats: ["es"]
|
|
108
|
+
// ES module format for native browser import
|
|
106
109
|
}
|
|
107
110
|
}), n.plugins ?? (n.plugins = []), t.externalize) {
|
|
108
111
|
const s = t.externalize === !0 ? m : t.externalize;
|
|
@@ -120,10 +123,14 @@ const g = (l) => {
|
|
|
120
123
|
);
|
|
121
124
|
const u = {
|
|
122
125
|
imports: {
|
|
126
|
+
// Microfrontend applications
|
|
123
127
|
...d,
|
|
128
|
+
// Common dependencies (Vue ecosystem)
|
|
124
129
|
...Object.keys(o).reduce((s, i) => (s[i] = `https://cdn.jsdelivr.net/npm/${i}@${o[i]}`, s), {}),
|
|
130
|
+
// Specific external packages (UI library, core packages)
|
|
125
131
|
...a
|
|
126
132
|
},
|
|
133
|
+
// Scopes allow different module resolution in specific contexts
|
|
127
134
|
scopes: t.importMapScopes ?? {}
|
|
128
135
|
};
|
|
129
136
|
t.replaceFmmfPackages && Object.entries(t.replaceFmmfPackages).forEach(([s, i]) => {
|
|
@@ -135,28 +142,35 @@ const g = (l) => {
|
|
|
135
142
|
const v = {
|
|
136
143
|
name: "vite-plugin-feedme-microfrontend",
|
|
137
144
|
enforce: "pre",
|
|
145
|
+
// Run before other plugins
|
|
138
146
|
config: async () => {
|
|
139
147
|
},
|
|
140
148
|
transformIndexHtml: {
|
|
141
149
|
enforce: "pre",
|
|
150
|
+
// Transform HTML early in the pipeline
|
|
142
151
|
transform(s) {
|
|
143
152
|
return {
|
|
144
153
|
html: s,
|
|
145
154
|
tags: [
|
|
155
|
+
// Inject the importmap script tag containing module mappings
|
|
146
156
|
{
|
|
147
157
|
tag: "script",
|
|
148
158
|
attrs: {
|
|
149
159
|
type: "importmap"
|
|
160
|
+
// Special script type for ES module imports
|
|
150
161
|
},
|
|
151
162
|
children: JSON.stringify(u, null, 2),
|
|
152
163
|
injectTo: "head-prepend"
|
|
164
|
+
// Add at the beginning of <head>
|
|
153
165
|
},
|
|
166
|
+
// Inject es-module-shims for browsers without native importmap support
|
|
154
167
|
{
|
|
155
168
|
tag: "script",
|
|
156
169
|
attrs: {
|
|
157
170
|
src: "https://cdn.jsdelivr.net/npm/es-module-shims@1.8.0/dist/es-module-shims.min.js"
|
|
158
171
|
},
|
|
159
172
|
injectTo: "head-prepend"
|
|
173
|
+
// Load before importmap
|
|
160
174
|
}
|
|
161
175
|
]
|
|
162
176
|
};
|