@feedmepos/mf-common 1.6.3-rc.2 → 1.6.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,86 +1,86 @@
1
1
  import { resolve as h } from "path";
2
2
  import { readFileSync as v } from "fs";
3
3
  const b = (l) => {
4
- const s = l.join("|");
5
- return new RegExp(`^(${s})(\\/.*)?$`);
4
+ const r = l.join("|");
5
+ return new RegExp(`^(${r})(\\/.*)?$`);
6
6
  }, j = ({
7
7
  externals: l
8
8
  }) => {
9
- const s = b(l);
9
+ const r = b(l);
10
10
  return {
11
11
  name: "externalize",
12
12
  setup(e) {
13
- e.onResolve({ filter: s }, (r) => ({
14
- path: r.path,
13
+ e.onResolve({ filter: r }, (t) => ({
14
+ path: t.path,
15
15
  namespace: "externalize"
16
- })), e.onLoad({ filter: s }, () => ({
16
+ })), e.onLoad({ filter: r }, () => ({
17
17
  contents: ""
18
18
  }));
19
19
  }
20
20
  };
21
21
  }, O = (l) => {
22
- const s = "/@id/", e = new RegExp(
23
- `${s}(${l.join("|")})`,
22
+ const r = "/@id/", e = new RegExp(
23
+ `${r}(${l.join("|")})`,
24
24
  "g"
25
25
  );
26
26
  return {
27
27
  name: "vite-plugin-remove-prefix",
28
- transform: (r) => e.test(r) ? r.replace(
28
+ transform: (t) => e.test(t) ? t.replace(
29
29
  e,
30
- (n, c) => c
31
- ) : r
30
+ (p, c) => c
31
+ ) : t
32
32
  };
33
33
  }, z = (l) => {
34
- const { externals: s } = l;
34
+ const { externals: r } = l;
35
35
  return {
36
36
  name: "vite-plugin-externalize",
37
37
  enforce: "pre",
38
38
  apply: "serve",
39
39
  config: (e) => {
40
- var r;
41
- const n = { ...e };
42
- return n.optimizeDeps && n.optimizeDeps.esbuildOptions && ((r = n.optimizeDeps.esbuildOptions).plugins ?? (r.plugins = []), n.optimizeDeps.esbuildOptions.plugins.push(
43
- j({ externals: s })
44
- )), n;
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
45
  },
46
46
  configResolved: (e) => {
47
47
  if (e.optimizeDeps && e.optimizeDeps.include) {
48
- const n = e.optimizeDeps.include.filter(
49
- (c) => !s.includes(c)
48
+ const p = e.optimizeDeps.include.filter(
49
+ (c) => !r.includes(c)
50
50
  );
51
- e.optimizeDeps.include = n;
51
+ e.optimizeDeps.include = p;
52
52
  }
53
- e.optimizeDeps && (e.optimizeDeps.exclude = e.optimizeDeps.exclude || [], e.optimizeDeps.exclude.push(...s));
54
- const r = O(s);
55
- e.plugins.push(r);
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
56
  },
57
57
  // Supresses the following warning:
58
58
  // Failed to resolve import [dependency] from [sourceFile]. Does the file exist?
59
- resolveId: (e) => s.includes(e) ? { id: e, external: !0 } : null,
59
+ resolveId: (e) => r.includes(e) ? { id: e, external: !0 } : null,
60
60
  // Supresses the following warning:
61
61
  // The following dependencies are imported but could not be resolved:
62
62
  // [dependency] (imported by [sourceFile])
63
- load: (e) => s.includes(e) ? "export default {};" : null
63
+ load: (e) => r.includes(e) ? "export default {};" : null
64
64
  };
65
- }, y = "@feedmepos/mf-", P = (l, { command: s, mode: e }, r = {}) => {
65
+ }, y = "@feedmepos/mf-", P = (l, { command: r, mode: e }, t = {}) => {
66
66
  var m, d, f, g;
67
- const n = JSON.parse(
67
+ const p = JSON.parse(
68
68
  v(h(process.cwd(), "package.json"), "utf-8")
69
- ), c = Object.keys(n.dependencies).filter((t) => t.startsWith(y)).reduce((t, i) => (t[i] = n.dependencies[i], t), {});
70
- (m = r.includeFmmfPackages) == null || m.forEach((t) => {
71
- c[t] = n.dependencies[t] ?? "latest";
72
- }), (d = r.excludeFmmfPackages) == null || d.forEach((t) => {
73
- delete c[t];
69
+ ), c = Object.keys(p.dependencies).filter((s) => s.startsWith(y)).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
74
  });
75
75
  const o = {
76
- "@vue/devtools-api": "^6.5.0/lib/esm/index.js",
77
- vue: "^3.3.4/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"
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
80
  };
81
- let u = [...Object.keys(o), ...Object.keys(c)];
82
- const p = { ...l };
83
- s == "build" && e.startsWith("fmmf") && (u = [...Object.keys(c), ...Object.keys(o)], p.build = {
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
84
  emptyOutDir: !0,
85
85
  lib: {
86
86
  entry: {
@@ -89,20 +89,21 @@ const b = (l) => {
89
89
  formats: ["es"]
90
90
  },
91
91
  rollupOptions: {
92
- external: u
92
+ external: a
93
93
  }
94
- }), p.plugins ?? (p.plugins = []), p.plugins.push(z({ externals: u })), p.build ?? (p.build = {}), (f = p.build).rollupOptions ?? (f.rollupOptions = {}), (g = p.build.rollupOptions).external ?? (g.external = u);
95
- const a = {
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
96
  imports: {
97
- ...Object.keys(c).reduce((t, i) => (t[i] = `https://cdn.jsdelivr.net/npm/${i}@latest/dist/app.js`, t), {}),
98
- ...Object.keys(o).reduce((t, i) => (t[i] = `https://cdn.jsdelivr.net/npm/${i}@${o[i]}`, t), {})
99
- }
97
+ ...Object.keys(c).reduce((s, i) => (s[i] = `https://cdn.jsdelivr.net/npm/${i}@latest/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 ?? {}
100
101
  };
101
- r.replaceFmmfPackages && Object.entries(r.replaceFmmfPackages).forEach(([t, i]) => {
102
- if (t.startsWith("@feedmepos/mf-") || t === "@feedmepos/ui-library")
103
- a.imports[t] = i;
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;
104
105
  else
105
- throw new Error(`Invalid replaceFmmfPackages key: ${t}, must start with @feedmepos/mf-`);
106
+ throw new Error(`Invalid replaceFmmfPackages key: ${s}, must start with @feedmepos/mf-`);
106
107
  });
107
108
  const x = {
108
109
  name: "vite-plugin-feedme-microfrontend",
@@ -111,16 +112,16 @@ const b = (l) => {
111
112
  },
112
113
  transformIndexHtml: {
113
114
  enforce: "pre",
114
- transform(t) {
115
+ transform(s) {
115
116
  return {
116
- html: t,
117
+ html: s,
117
118
  tags: [
118
119
  {
119
120
  tag: "script",
120
121
  attrs: {
121
122
  type: "importmap"
122
123
  },
123
- children: JSON.stringify(a, null, 2),
124
+ children: JSON.stringify(u, null, 2),
124
125
  injectTo: "head-prepend"
125
126
  },
126
127
  {
@@ -135,7 +136,7 @@ const b = (l) => {
135
136
  }
136
137
  }
137
138
  };
138
- return p.plugins.push(x), p;
139
+ return n.plugins.push(x), n;
139
140
  };
140
141
  export {
141
142
  P as fmmfVitePresent
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-common",
3
- "version": "1.6.3-rc.2",
3
+ "version": "1.6.3",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -16,6 +16,7 @@
16
16
  "./style.css": "./dist/style.css"
17
17
  },
18
18
  "dependencies": {
19
+ "@feedmepos/auth": "^1.1.2",
19
20
  "@feedmepos/core": "^2.0.0",
20
21
  "@vue/devtools-api": "^6.5.0",
21
22
  "axios": "^1.6.0",
package/dist/auth.d.ts DELETED
@@ -1,34 +0,0 @@
1
- export interface FeedMeAuthOptions {
2
- clientId: string;
3
- }
4
- export interface FeedMeUser {
5
- id: string;
6
- email?: string | null;
7
- photoURL?: string | null;
8
- displayName?: string | null;
9
- phoneNumber?: string | null;
10
- }
11
- export declare class FeedMeAuth {
12
- static clientId: string;
13
- static baseUrl: string;
14
- private static authStateChangeCallbacks;
15
- private static bgIframe;
16
- private static _token;
17
- static get token(): string | null;
18
- static setBaseUrl(isDev: boolean): void;
19
- static initialize(clientId: string): void;
20
- static signIn(root?: HTMLElement): void;
21
- static setToken(token: string): void;
22
- static onAuthStateChanged(callback: (user: FeedMeUser | null, token: string | null) => void): () => void;
23
- static signOut(): void;
24
- static unmountPrompt(): void;
25
- static getCustomToken(): Promise<string>;
26
- static refreshToken(): Promise<string>;
27
- static getUserClaims(): Promise<{
28
- /** in seconds since the Unix epoch. */
29
- exp: number;
30
- customClaims: Record<string, unknown> | undefined;
31
- }>;
32
- private static startBackground;
33
- }
34
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/auth.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,WAAW,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