vite-plugin-zephyr 0.0.0-canary-20241116123955

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. package/LICENSE +39 -0
  2. package/README.md +1 -0
  3. package/dist/index.d.ts +2 -0
  4. package/dist/index.js +8 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/lib/load_extra_files_from_dist.d.ts +8 -0
  7. package/dist/lib/load_extra_files_from_dist.js +37 -0
  8. package/dist/lib/load_extra_files_from_dist.js.map +1 -0
  9. package/dist/lib/load_public_dir.d.ts +7 -0
  10. package/dist/lib/load_public_dir.js +38 -0
  11. package/dist/lib/load_public_dir.js.map +1 -0
  12. package/dist/lib/load_static_entries.d.ts +7 -0
  13. package/dist/lib/load_static_entries.js +35 -0
  14. package/dist/lib/load_static_entries.js.map +1 -0
  15. package/dist/lib/remote_map_parser.d.ts +20 -0
  16. package/dist/lib/remote_map_parser.js +90 -0
  17. package/dist/lib/remote_map_parser.js.map +1 -0
  18. package/dist/lib/resolve_remote_dependency.d.ts +10 -0
  19. package/dist/lib/resolve_remote_dependency.js +30 -0
  20. package/dist/lib/resolve_remote_dependency.js.map +1 -0
  21. package/dist/lib/types/zephyr-internal-options.d.ts +11 -0
  22. package/dist/lib/types/zephyr-internal-options.js +3 -0
  23. package/dist/lib/types/zephyr-internal-options.js.map +1 -0
  24. package/dist/lib/vite-plugin-zephyr-partial.d.ts +10 -0
  25. package/dist/lib/vite-plugin-zephyr-partial.js +162 -0
  26. package/dist/lib/vite-plugin-zephyr-partial.js.map +1 -0
  27. package/dist/lib/vite-plugin-zephyr.d.ts +8 -0
  28. package/dist/lib/vite-plugin-zephyr.js +179 -0
  29. package/dist/lib/vite-plugin-zephyr.js.map +1 -0
  30. package/dist/lib/zephyr-internal-options.d.ts +7 -0
  31. package/dist/lib/zephyr-internal-options.js +3 -0
  32. package/dist/lib/zephyr-internal-options.js.map +1 -0
  33. package/dist/package.json +27 -0
  34. package/package.json +26 -0
package/LICENSE ADDED
@@ -0,0 +1,39 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ ...
13
+
14
+ END OF TERMS AND CONDITIONS
15
+
16
+ APPENDIX: How to apply the Apache License to your work.
17
+
18
+ To apply the Apache License to your work, attach the following
19
+ boilerplate notice, with the fields enclosed by brackets "[]"
20
+ replaced with your own identifying information. (Don't include
21
+ the brackets!) The text should be enclosed in the appropriate
22
+ comment syntax for the file format. We also recommend that a
23
+ file or class name and description of purpose be included on the
24
+ same line as the copyright notice for each file. The "copyright"
25
+ word should be left as is (without quotes).
26
+
27
+ Copyright [2023] [Zephyr Cloud]
28
+
29
+ Licensed under the Apache License, Version 2.0 (the "License");
30
+ you may not use this file except in compliance with the License.
31
+ You may obtain a copy of the License at
32
+
33
+ http://www.apache.org/licenses/LICENSE-2.0
34
+
35
+ Unless required by applicable law or agreed to in writing, software
36
+ distributed under the License is distributed on an "AS IS" BASIS,
37
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
38
+ See the License for the specific language governing permissions and
39
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # vite-plugin-zephyr
@@ -0,0 +1,2 @@
1
+ export { withZephyr } from './lib/vite-plugin-zephyr';
2
+ export { withZephyrPartial } from './lib/vite-plugin-zephyr-partial';
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withZephyrPartial = exports.withZephyr = void 0;
4
+ var vite_plugin_zephyr_1 = require("./lib/vite-plugin-zephyr");
5
+ Object.defineProperty(exports, "withZephyr", { enumerable: true, get: function () { return vite_plugin_zephyr_1.withZephyr; } });
6
+ var vite_plugin_zephyr_partial_1 = require("./lib/vite-plugin-zephyr-partial");
7
+ Object.defineProperty(exports, "withZephyrPartial", { enumerable: true, get: function () { return vite_plugin_zephyr_partial_1.withZephyrPartial; } });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,+DAAsD;AAA7C,gHAAA,UAAU,OAAA;AACnB,+EAAqE;AAA5D,+HAAA,iBAAiB,OAAA"}
@@ -0,0 +1,8 @@
1
+ import { OutputAsset, OutputBundle } from 'rollup';
2
+ interface LoadExtraFilesFromDistOptions {
3
+ root: string;
4
+ bundle: OutputBundle;
5
+ outDir: string;
6
+ }
7
+ export declare function load_extra_files_from_dist(props: LoadExtraFilesFromDistOptions): Promise<OutputAsset[]>;
8
+ export {};
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.load_extra_files_from_dist = void 0;
4
+ const node_path_1 = require("node:path");
5
+ const node_fs_1 = require("node:fs");
6
+ const vite_1 = require("vite");
7
+ const node_util_1 = require("node:util");
8
+ async function load_extra_files_from_dist(props) {
9
+ const { root, bundle } = props;
10
+ const publicAssets = [];
11
+ const root_dist_dir = (0, node_path_1.resolve)(root, props.outDir);
12
+ const loadDir = async (destDir) => {
13
+ for (const file of (0, node_fs_1.readdirSync)(destDir)) {
14
+ const destFile = (0, node_path_1.resolve)(destDir, file);
15
+ const stat = (0, node_fs_1.statSync)(destFile);
16
+ if (stat.isDirectory()) {
17
+ await loadDir(destFile);
18
+ continue;
19
+ }
20
+ const fileName = (0, vite_1.normalizePath)((0, node_path_1.relative)(root_dist_dir, destFile));
21
+ if (!(fileName in bundle)) {
22
+ publicAssets.push({
23
+ fileName,
24
+ name: file,
25
+ needsCodeReference: false,
26
+ source: await (0, node_util_1.promisify)(node_fs_1.readFile)(destFile),
27
+ type: 'asset',
28
+ originalFileName: file,
29
+ });
30
+ }
31
+ }
32
+ };
33
+ await loadDir(root_dist_dir);
34
+ return publicAssets;
35
+ }
36
+ exports.load_extra_files_from_dist = load_extra_files_from_dist;
37
+ //# sourceMappingURL=load_extra_files_from_dist.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load_extra_files_from_dist.js","sourceRoot":"","sources":["../../src/lib/load_extra_files_from_dist.ts"],"names":[],"mappings":";;;AACA,yCAA8C;AAC9C,qCAA0D;AAC1D,+BAAqC;AACrC,yCAAsC;AAQ/B,KAAK,UAAU,0BAA0B,CAAC,KAAoC;IACnF,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAC/B,MAAM,YAAY,GAAkB,EAAE,CAAC;IAEvC,MAAM,aAAa,GAAG,IAAA,mBAAO,EAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,KAAK,EAAE,OAAe,EAAE,EAAE;QACxC,KAAK,MAAM,IAAI,IAAI,IAAA,qBAAW,EAAC,OAAO,CAAC,EAAE,CAAC;YACxC,MAAM,QAAQ,GAAG,IAAA,mBAAO,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YACxC,MAAM,IAAI,GAAG,IAAA,kBAAQ,EAAC,QAAQ,CAAC,CAAC;YAChC,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;gBACvB,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC;gBACxB,SAAS;YACX,CAAC;YACD,MAAM,QAAQ,GAAG,IAAA,oBAAa,EAAC,IAAA,oBAAQ,EAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC;YAClE,IAAI,CAAC,CAAC,QAAQ,IAAI,MAAM,CAAC,EAAE,CAAC;gBAC1B,YAAY,CAAC,IAAI,CAAC;oBAChB,QAAQ;oBACR,IAAI,EAAE,IAAI;oBACV,kBAAkB,EAAE,KAAK;oBACzB,MAAM,EAAE,MAAM,IAAA,qBAAS,EAAC,kBAAQ,CAAC,CAAC,QAAQ,CAAC;oBAC3C,IAAI,EAAE,OAAO;oBACb,gBAAgB,EAAE,IAAI;iBACvB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IACF,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC;IAE7B,OAAO,YAAY,CAAC;AACtB,CAAC;AA7BD,gEA6BC"}
@@ -0,0 +1,7 @@
1
+ import { OutputAsset } from 'rollup';
2
+ interface LoadPublicDirOptions {
3
+ outDir: string;
4
+ publicDir: string;
5
+ }
6
+ export declare function load_public_dir(props: LoadPublicDirOptions): Promise<OutputAsset[]>;
7
+ export {};
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.load_public_dir = void 0;
4
+ const node_fs_1 = require("node:fs");
5
+ const node_path_1 = require("node:path");
6
+ const vite_1 = require("vite");
7
+ const node_util_1 = require("node:util");
8
+ async function load_public_dir(props) {
9
+ const { publicDir, outDir } = props;
10
+ const publicAssets = [];
11
+ const loadDir = async (srcDir, destDir) => {
12
+ for (const file of (0, node_fs_1.readdirSync)(srcDir)) {
13
+ const srcFile = (0, node_path_1.resolve)(srcDir, file);
14
+ if (srcFile === destDir) {
15
+ continue;
16
+ }
17
+ const destFile = (0, node_path_1.resolve)(destDir, file);
18
+ const stat = (0, node_fs_1.statSync)(srcFile);
19
+ if (stat.isDirectory()) {
20
+ await loadDir(srcFile, destFile);
21
+ }
22
+ else {
23
+ publicAssets.push({
24
+ fileName: (0, vite_1.normalizePath)((0, node_path_1.relative)(outDir, destFile)),
25
+ name: (0, node_path_1.basename)(file),
26
+ needsCodeReference: false,
27
+ source: await (0, node_util_1.promisify)(node_fs_1.readFile)(srcFile),
28
+ type: 'asset',
29
+ originalFileName: (0, node_path_1.basename)(file),
30
+ });
31
+ }
32
+ }
33
+ };
34
+ await loadDir(publicDir, outDir);
35
+ return publicAssets;
36
+ }
37
+ exports.load_public_dir = load_public_dir;
38
+ //# sourceMappingURL=load_public_dir.js.map
@@ -0,0 +1 @@
1
+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C;IACF,MAAM,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,YAAY,CAAC;AACtB,CAAC;AA5BD,0CA4BC"}
@@ -0,0 +1,7 @@
1
+ import { OutputAsset } from 'rollup';
2
+ interface LoadStaticEntriesOptions {
3
+ root: string;
4
+ outDir: string;
5
+ }
6
+ export declare function load_static_entries(props: LoadStaticEntriesOptions): Promise<OutputAsset[]>;
7
+ export {};
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.load_static_entries = void 0;
4
+ const node_path_1 = require("node:path");
5
+ const node_fs_1 = require("node:fs");
6
+ const vite_1 = require("vite");
7
+ const node_util_1 = require("node:util");
8
+ async function load_static_entries(props) {
9
+ const { root } = props;
10
+ const publicAssets = [];
11
+ const root_dist_dir = (0, node_path_1.resolve)(root, props.outDir);
12
+ const loadDir = async (destDir) => {
13
+ for (const file of (0, node_fs_1.readdirSync)(destDir)) {
14
+ const destFile = (0, node_path_1.resolve)(destDir, file);
15
+ const stat = (0, node_fs_1.statSync)(destFile);
16
+ if (stat.isDirectory()) {
17
+ await loadDir(destFile);
18
+ continue;
19
+ }
20
+ const fileName = (0, vite_1.normalizePath)((0, node_path_1.relative)(root_dist_dir, destFile));
21
+ publicAssets.push({
22
+ fileName,
23
+ name: file,
24
+ needsCodeReference: false,
25
+ source: await (0, node_util_1.promisify)(node_fs_1.readFile)(destFile),
26
+ type: 'asset',
27
+ originalFileName: file,
28
+ });
29
+ }
30
+ };
31
+ await loadDir(root_dist_dir);
32
+ return publicAssets;
33
+ }
34
+ exports.load_static_entries = load_static_entries;
35
+ //# sourceMappingURL=load_static_entries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load_static_entries.js","sourceRoot":"","sources":["../../src/lib/load_static_entries.ts"],"names":[],"mappings":";;;AACA,yCAA8C;AAC9C,qCAA0D;AAC1D,+BAAqC;AACrC,yCAAsC;AAO/B,KAAK,UAAU,mBAAmB,CAAC,KAA+B;IACvE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IACvB,MAAM,YAAY,GAAkB,EAAE,CAAC;IAEvC,MAAM,aAAa,GAAG,IAAA,mBAAO,EAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAElD,MAAM,OAAO,GAAG,KAAK,EAAE,OAAe,EAAE,EAAE;QACxC,KAAK,MAAM,IAAI,IAAI,IAAA,qBAAW,EAAC,OAAO,CAAC,EAAE,CAAC;YACxC,MAAM,QAAQ,GAAG,IAAA,mBAAO,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YACxC,MAAM,IAAI,GAAG,IAAA,kBAAQ,EAAC,QAAQ,CAAC,CAAC;YAChC,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;gBACvB,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC;gBACxB,SAAS;YACX,CAAC;YACD,MAAM,QAAQ,GAAG,IAAA,oBAAa,EAAC,IAAA,oBAAQ,EAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC;YAClE,YAAY,CAAC,IAAI,CAAC;gBAChB,QAAQ;gBACR,IAAI,EAAE,IAAI;gBACV,kBAAkB,EAAE,KAAK;gBACzB,MAAM,EAAE,MAAM,IAAA,qBAAS,EAAC,kBAAQ,CAAC,CAAC,QAAQ,CAAC;gBAC3C,IAAI,EAAE,OAAO;gBACb,gBAAgB,EAAE,IAAI;aACvB,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC;IACF,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC;IAC7B,OAAO,YAAY,CAAC;AACtB,CAAC;AA3BD,kDA2BC"}
@@ -0,0 +1,20 @@
1
+ export interface RemoteEntry {
2
+ name: string;
3
+ entryGlobalName?: string;
4
+ entry: string;
5
+ type?: string;
6
+ }
7
+ export interface RemoteMapExtraction {
8
+ remotesMap: RemoteEntry[];
9
+ startIndex: number;
10
+ endIndex: number;
11
+ }
12
+ /**
13
+ * Parses the provided code to extract the remotes object.
14
+ *
15
+ * @param code - The code containing the remotes object declaration.
16
+ * @returns An object containing the remotes object and the start and end indices of the remotes object declaration in the code, or
17
+ * undefined if parsing fails.
18
+ */
19
+ export declare function parseRemoteMap(code: string, id: string): RemoteMapExtraction | undefined;
20
+ export declare function replaceProtocolAndHost(originalUrl: string, newProtocolAndHost: string): string;
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.replaceProtocolAndHost = exports.parseRemoteMap = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const json5_1 = tslib_1.__importDefault(require("json5"));
6
+ const zephyr_edge_contract_1 = require("zephyr-edge-contract");
7
+ const acorn_1 = tslib_1.__importDefault(require("acorn"));
8
+ const acorn_walk_1 = tslib_1.__importDefault(require("acorn-walk"));
9
+ /**
10
+ * Parses the provided code to extract the remotes object.
11
+ *
12
+ * @param code - The code containing the remotes object declaration.
13
+ * @returns An object containing the remotes object and the start and end indices of the remotes object declaration in the code, or
14
+ * undefined if parsing fails.
15
+ */
16
+ function parseRemoteMap(code, id) {
17
+ if (!id.includes('localSharedImportMap')) {
18
+ return undefined;
19
+ }
20
+ let arrayNode;
21
+ const startTime = Date.now();
22
+ // Parse the code into an AST
23
+ const ast = acorn_1.default.parse(code, {
24
+ ecmaVersion: 'latest',
25
+ sourceType: 'module',
26
+ locations: true, // Include line and column numbers
27
+ ranges: true, // Include start and end indices
28
+ });
29
+ // Visitor function to find the variable declaration
30
+ function findUsedRemotes(node) {
31
+ if (node.type === 'VariableDeclaration' && node.kind === 'const') {
32
+ for (const declarator of node.declarations) {
33
+ if (declarator.id.type === 'Identifier' && declarator.id.name === 'usedRemotes' && declarator.init) {
34
+ // Found the 'usedRemotes' variable
35
+ arrayNode = declarator.init;
36
+ break;
37
+ }
38
+ }
39
+ }
40
+ }
41
+ acorn_walk_1.default.simple(ast, {
42
+ VariableDeclaration: findUsedRemotes,
43
+ });
44
+ const endTime = Date.now();
45
+ (0, zephyr_edge_contract_1.ze_log)(`parseRemoteMap took ${endTime - startTime}ms`);
46
+ if (!arrayNode) {
47
+ return;
48
+ }
49
+ (0, zephyr_edge_contract_1.ze_log)('vite.arrayNode found: ', arrayNode);
50
+ // Get start and end indices
51
+ const startIndex = arrayNode.start;
52
+ const endIndex = arrayNode.end;
53
+ // Extract the array text from the code
54
+ const arrayText = code.slice(startIndex, endIndex);
55
+ let remotesArray;
56
+ try {
57
+ // Use a faster JSON parser if possible
58
+ remotesArray = JSON.parse(arrayText);
59
+ (0, zephyr_edge_contract_1.ze_log)('vite.parseRemoteMap.remotesArray: ', remotesArray);
60
+ }
61
+ catch (error) {
62
+ // Fallback to json5 only if necessary
63
+ try {
64
+ remotesArray = json5_1.default.parse(arrayText);
65
+ }
66
+ catch (innerError) {
67
+ return;
68
+ }
69
+ }
70
+ return {
71
+ remotesMap: remotesArray,
72
+ startIndex,
73
+ endIndex,
74
+ };
75
+ }
76
+ exports.parseRemoteMap = parseRemoteMap;
77
+ function replaceProtocolAndHost(originalUrl, newProtocolAndHost) {
78
+ (0, zephyr_edge_contract_1.ze_log)('vite.replaceProtocalAndHost.originalUrl: ', originalUrl);
79
+ (0, zephyr_edge_contract_1.ze_log)('vite.replaceProtocalAndHost: ', newProtocolAndHost);
80
+ const url = new URL(originalUrl);
81
+ const newUrl = new URL(newProtocolAndHost);
82
+ // Replace protocol and hostname
83
+ url.protocol = newUrl.protocol;
84
+ url.hostname = newUrl.hostname;
85
+ url.port = '';
86
+ (0, zephyr_edge_contract_1.ze_log)('vite.transformedUrl: ', url.toString());
87
+ return url.toString();
88
+ }
89
+ exports.replaceProtocolAndHost = replaceProtocolAndHost;
90
+ //# sourceMappingURL=remote_map_parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote_map_parser.js","sourceRoot":"","sources":["../../src/lib/remote_map_parser.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAC1B,+DAA8C;AAC9C,0DAA0B;A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AAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IAEhD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AACxB,CAAC;AAdD,wDAcC"}
@@ -0,0 +1,10 @@
1
+ export declare function resolve_remote_dependency({ name, version }: {
2
+ name: string;
3
+ version: string;
4
+ }): Promise<ResolvedDependency | void>;
5
+ export interface ResolvedDependency {
6
+ remote_name: string;
7
+ default_url: string;
8
+ application_uid: string;
9
+ remote_entry_url: string;
10
+ }
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolve_remote_dependency = void 0;
4
+ const zephyr_edge_contract_1 = require("zephyr-edge-contract");
5
+ async function resolve_remote_dependency({ name, version }) {
6
+ const resolveDependency = new URL(`${zephyr_edge_contract_1.ze_api_gateway.resolve}/${encodeURIComponent(name)}/${encodeURIComponent(version)}`, (0, zephyr_edge_contract_1.ZE_API_ENDPOINT)());
7
+ (0, zephyr_edge_contract_1.ze_log)('Resolving dependency', name, version, resolveDependency);
8
+ try {
9
+ const token = await (0, zephyr_edge_contract_1.getToken)();
10
+ const res = await fetch(resolveDependency, {
11
+ method: 'GET',
12
+ headers: {
13
+ 'Content-Type': 'application/json',
14
+ Authorization: 'Bearer ' + token,
15
+ Accept: 'application/json',
16
+ },
17
+ });
18
+ if (!res.ok) {
19
+ throw new Error(res.statusText);
20
+ }
21
+ const response = (await res.json());
22
+ (0, zephyr_edge_contract_1.ze_log)('[Vite]: resolve remote dependency response: ', response);
23
+ return response === null || response === void 0 ? void 0 : response.value;
24
+ }
25
+ catch (err) {
26
+ (0, zephyr_edge_contract_1.ze_error)('ERR_NOT_RESOLVE_APP_NAME_WITH_VERSION', `Could not resolve '${name}' with version '${version}'`);
27
+ }
28
+ }
29
+ exports.resolve_remote_dependency = resolve_remote_dependency;
30
+ //# sourceMappingURL=resolve_remote_dependency.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve_remote_dependency.js","sourceRoot":"","s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4
+ publicDir?: string;
5
+ dir?: string;
6
+ }
7
+ export interface ZephyrPartialInternalOptions {
8
+ root: string;
9
+ outDir: string;
10
+ publicDir?: string;
11
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=zephyr-internal-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zephyr-internal-options.js","sourceRoot":"","sources":["../../../src/lib/types/zephyr-internal-options.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { NormalizedOutputOptions, OutputBundle } from 'rollup';
2
+ import type { ResolvedConfig } from 'vite';
3
+ export declare function withZephyrPartial(): {
4
+ name: string;
5
+ apply: string;
6
+ enforce: string;
7
+ configResolved: (config: ResolvedConfig) => Promise<void>;
8
+ writeBundle: (options: NormalizedOutputOptions, _bundle: OutputBundle) => Promise<void>;
9
+ closeBundle: () => Promise<void>;
10
+ };
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withZephyrPartial = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const isCI = tslib_1.__importStar(require("is-ci"));
6
+ const zephyr_agent_1 = require("zephyr-agent");
7
+ const zephyr_edge_contract_1 = require("zephyr-edge-contract");
8
+ const load_extra_files_from_dist_1 = require("./load_extra_files_from_dist");
9
+ const load_public_dir_1 = require("./load_public_dir");
10
+ function withZephyrPartial() {
11
+ let bundle = {};
12
+ const vite_internal_options = {};
13
+ return {
14
+ name: 'with-zephyr-partial',
15
+ apply: 'build',
16
+ enforce: 'post',
17
+ configResolved: async (config) => {
18
+ Object.assign(vite_internal_options, {
19
+ root: config.root,
20
+ configFile: config.configFile,
21
+ outDir: config.build.outDir,
22
+ publicDir: config.publicDir,
23
+ });
24
+ },
25
+ writeBundle: async (options, _bundle) => {
26
+ vite_internal_options.dir = options.dir;
27
+ bundle = _bundle;
28
+ },
29
+ closeBundle: async () => {
30
+ const publicAssets = [];
31
+ if (vite_internal_options.publicDir) {
32
+ const _public_assets = await (0, load_public_dir_1.load_public_dir)({
33
+ outDir: vite_internal_options.outDir,
34
+ publicDir: vite_internal_options.publicDir,
35
+ });
36
+ publicAssets.push(..._public_assets);
37
+ }
38
+ const _extra_assets = await (0, load_extra_files_from_dist_1.load_extra_files_from_dist)({
39
+ root: vite_internal_options.root,
40
+ outDir: vite_internal_options.outDir,
41
+ bundle,
42
+ });
43
+ publicAssets.push(..._extra_assets);
44
+ const assets = Object.assign({}, bundle, ...publicAssets.map((asset) => ({ [asset.fileName]: asset })));
45
+ await _zephyr_partial({ assets, vite_internal_options });
46
+ },
47
+ };
48
+ }
49
+ exports.withZephyrPartial = withZephyrPartial;
50
+ async function _zephyr_partial(options) {
51
+ var _a;
52
+ const { assets, vite_internal_options } = options;
53
+ const path_to_execution_dir = vite_internal_options.root;
54
+ (0, zephyr_edge_contract_1.ze_log)('Configuring with Zephyr...');
55
+ const packageJson = await (0, zephyr_agent_1.getPackageJson)(path_to_execution_dir);
56
+ (0, zephyr_edge_contract_1.ze_log)('Loaded Package JSON', packageJson);
57
+ if (!packageJson)
58
+ return (0, zephyr_edge_contract_1.ze_error)('ERR_PACKAGE_JSON_NOT_FOUND');
59
+ const gitInfo = await (0, zephyr_agent_1.getGitInfo)();
60
+ (0, zephyr_edge_contract_1.ze_log)('Loaded Git Info', gitInfo);
61
+ if (!gitInfo || !(gitInfo === null || gitInfo === void 0 ? void 0 : gitInfo.app.org) || !(gitInfo === null || gitInfo === void 0 ? void 0 : gitInfo.app.project))
62
+ return (0, zephyr_edge_contract_1.ze_error)('ERR_NO_GIT_INFO', 'Can you confirm the current directory has initialized as a git repository?');
63
+ if (!(packageJson === null || packageJson === void 0 ? void 0 : packageJson.name))
64
+ return (0, zephyr_edge_contract_1.ze_error)('ERR_PACKAGE_JSON_MUST_HAVE_NAME_VERSION', 'package.json must have a name and version.');
65
+ const application_uid = (0, zephyr_edge_contract_1.createApplicationUID)({
66
+ org: gitInfo.app.org,
67
+ project: gitInfo.app.project,
68
+ name: packageJson === null || packageJson === void 0 ? void 0 : packageJson.name,
69
+ });
70
+ (0, zephyr_edge_contract_1.ze_log)('Going to check auth token or get it...');
71
+ await (0, zephyr_agent_1.checkAuth)();
72
+ (0, zephyr_edge_contract_1.ze_log)('Got auth token, going to get application configuration and build id...');
73
+ const [appConfig, buildId, hash_set] = await Promise.all([
74
+ (0, zephyr_agent_1.getApplicationConfiguration)({ application_uid }),
75
+ (0, zephyr_agent_1.getBuildId)(application_uid),
76
+ (0, zephyr_agent_1.get_hash_list)(application_uid),
77
+ ]);
78
+ const { username, email, EDGE_URL } = appConfig;
79
+ (0, zephyr_edge_contract_1.ze_log)('Got application configuration', { username, email, EDGE_URL });
80
+ if (!buildId)
81
+ return (0, zephyr_edge_contract_1.ze_error)('ERR_GET_BUILD_ID');
82
+ const pluginOptions = {
83
+ pluginName: 'rollup-plugin-zephyr',
84
+ application_uid,
85
+ buildEnv: 'local',
86
+ username,
87
+ app: {
88
+ name: packageJson.name,
89
+ version: packageJson.version,
90
+ org: gitInfo.app.org,
91
+ project: gitInfo.app.project,
92
+ },
93
+ git: gitInfo.git,
94
+ isCI,
95
+ zeConfig: {
96
+ user: username,
97
+ edge_url: EDGE_URL,
98
+ buildId,
99
+ },
100
+ mfConfig: void 0,
101
+ };
102
+ (0, zephyr_edge_contract_1.ze_log)('\n--------\n zephyr agent started. \n ------ \n');
103
+ const logEvent = (0, zephyr_agent_1.logger)(pluginOptions);
104
+ logEvent({
105
+ level: 'info',
106
+ action: 'build:info:user',
107
+ ignore: true,
108
+ message: `Hi ${(0, zephyr_edge_contract_1.cyanBright)(username)}!\n${(0, zephyr_edge_contract_1.white)(application_uid)}${(0, zephyr_edge_contract_1.yellow)(`#${buildId}`)}\n`,
109
+ });
110
+ const zeStart = Date.now();
111
+ const extractBuffer = (asset) => {
112
+ switch (asset.type) {
113
+ case 'chunk':
114
+ return asset.code;
115
+ case 'asset':
116
+ return typeof asset.source === 'string' ? asset.source : new TextDecoder().decode(asset.source);
117
+ default:
118
+ return void 0;
119
+ }
120
+ };
121
+ const getAssetType = (asset) => asset.type;
122
+ const assetsMap = Object.keys(assets).reduce((memo, filepath) => {
123
+ const asset = assets[filepath];
124
+ const buffer = extractBuffer(asset);
125
+ if (!buffer && buffer !== '') {
126
+ logEvent({
127
+ action: 'ze:build:assets:unknown-asset-type',
128
+ level: 'error',
129
+ message: `unknown asset type: ${getAssetType(asset)}`,
130
+ });
131
+ return memo;
132
+ }
133
+ const assetMap = (0, zephyr_agent_1.getZeBuildAsset)({ filepath, content: buffer });
134
+ memo[assetMap.hash] = assetMap;
135
+ return memo;
136
+ }, {});
137
+ const snapshot = (0, zephyr_agent_1.createSnapshot)({
138
+ options: pluginOptions,
139
+ assets: assetsMap,
140
+ username,
141
+ email,
142
+ });
143
+ await (0, zephyr_agent_1.zeUploadSnapshot)({ pluginOptions, snapshot, appConfig }).catch((err) => (0, zephyr_edge_contract_1.ze_error)('ERR_FAILED_UPLOAD_SNAPSHOTS', 'Failed to upload snapshot.', err));
144
+ const missingAssets = (0, zephyr_agent_1.get_missing_assets)({ assetsMap, hash_set });
145
+ const assetsUploadSuccess = await (0, zephyr_agent_1.zeUploadAssets)(pluginOptions, {
146
+ missingAssets,
147
+ assetsMap,
148
+ count: Object.keys(assets).length,
149
+ });
150
+ if (!assetsUploadSuccess)
151
+ return (0, zephyr_edge_contract_1.ze_error)('ERR_FAILED_UPLOAD_ASSETS', assetsUploadSuccess);
152
+ if (missingAssets.length) {
153
+ await (0, zephyr_agent_1.update_hash_list)(application_uid, assetsMap);
154
+ }
155
+ await (0, zephyr_edge_contract_1.savePartialAssetMap)(application_uid, (_a = vite_internal_options.configFile) !== null && _a !== void 0 ? _a : 'partial', assetsMap);
156
+ logEvent({
157
+ level: 'info',
158
+ action: 'build:deploy:done',
159
+ message: `Deployment took ${(0, zephyr_edge_contract_1.yellow)(`${Date.now() - zeStart}`)}ms`,
160
+ });
161
+ }
162
+ //# sourceMappingURL=vite-plugin-zephyr-partial.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite-plugin-zephyr-partial.js","sourceRoot":"","sources":["../../src/lib/vite-plugin-zephyr-partial.ts"],"names":[],"mappings":";;;;AAAA,oDAA8B;AAG9B,+CAcsB;AACtB,+DAU8B;AAC9B,6EAA0E;AAC1E,uDAAoD;AAGpD,SAAgB,iBAAiB;IAC/B,IAAI,MAAM,GAAiB,EAAE,CAAC;IAC9B,MAAM,qBAAqB,GAAG,EAA2B,CAAC;IAE1D,OAAO;QACL,IAAI,EAAE,qBAAqB;QAC3B,KAAK,EAAE,OAAO;QACd,OAAO,EAAE,MAAM;QACf,cAAc,EAAE,KAAK,EAAE,MAAsB,EAAE,EAAE;YAC/C,MAAM,CAAC,MAAM,CAAC,qBAAqB,EAAE;gBACnC,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM;gBAC3B,SAAS,EAAE,MAAM,CAAC,SAAS;aAC5B,CAAC,CAAC;QACL,CAAC;QAED,WAAW,EAAE,KAAK,EAAE,OAAgC,EAAE,OAAqB,EAAE,EAAE;YAC7E,qBAAqB,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;YACxC,MAAM,GAAG,OAAO,CAAC;QACnB,CAAC;QAED,WAAW,EAAE,KAAK,IAAI,EAAE;YACtB,MAAM,YAAY,GAAkB,EAAE,CAAC;YAEvC,IAAI,qBAAqB,CAAC,SAAS,EAAE,CAAC;gBACpC,MAAM,cAAc,GAAG,MAAM,IAAA,iCAAe,EAAC;oBAC3C,MAAM,EAAE,qBAAqB,CAAC,MAAM;oBACpC,SAAS,EAAE,qBAAqB,CAAC,SAAS;iBAC3C,CAAC,CAAC;gBACH,YAAY,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,CAAC;YACvC,CAAC;YAED,MAAM,aAAa,GAAG,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MAAM;KAClC,CAAC,CAAC;IAEH,IAAI,CAAC,mBAAmB;QAAE,OAAO,IAAA,+BAAQ,EAAC,0BAA0B,EAAE,mBAAmB,CAAC,CAAC;IAE3F,IAAI,aAAa,CAAC,MAAM,EAAE,CAAC;QACzB,MAAM,IAAA,+BAAgB,EAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,IAAA,0CAAmB,EAAC,eAAe,EAAE,MAAA,qBAAqB,CAAC,UAAU,mCAAI,SAAS,EAAE,SAAS,CAAC,CAAC;IAErG,QAAQ,CAAC;QACP,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,mBAAmB;QAC3B,OAAO,EAAE,mBAAmB,IAAA,6BAAM,EAAC,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC,IAAI;KAClE,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { Plugin } from 'vite';
2
+ import { federation } from '@module-federation/vite';
3
+ type FederationFunction = typeof federation;
4
+ interface VitePluginZephyrOptions {
5
+ mfConfig?: Parameters<FederationFunction>[0];
6
+ }
7
+ export declare function withZephyr(_options?: VitePluginZephyrOptions): Plugin[];
8
+ export {};
@@ -0,0 +1,179 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withZephyr = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const isCI = tslib_1.__importStar(require("is-ci"));
6
+ const zephyr_agent_1 = require("zephyr-agent");
7
+ const zephyr_edge_contract_1 = require("zephyr-edge-contract");
8
+ const load_public_dir_1 = require("./load_public_dir");
9
+ const load_static_entries_1 = require("./load_static_entries");
10
+ const remote_map_parser_1 = require("./remote_map_parser");
11
+ const resolve_remote_dependency_1 = require("./resolve_remote_dependency");
12
+ const vite_1 = require("@module-federation/vite");
13
+ function withZephyr(_options) {
14
+ const mfConfig = _options === null || _options === void 0 ? void 0 : _options.mfConfig;
15
+ return mfConfig ? (0, vite_1.federation)(mfConfig).concat([zephyrPlugin(_options)]) : [zephyrPlugin(_options)];
16
+ }
17
+ exports.withZephyr = withZephyr;
18
+ function zephyrPlugin(_options) {
19
+ let gitInfo;
20
+ let packageJson;
21
+ let application_uid;
22
+ const vite_internal_options = {};
23
+ return {
24
+ name: 'with-zephyr',
25
+ enforce: 'post',
26
+ configResolved: async (config) => {
27
+ var _a;
28
+ Object.assign(vite_internal_options, {
29
+ root: config.root,
30
+ outDir: (_a = config.build) === null || _a === void 0 ? void 0 : _a.outDir,
31
+ publicDir: config.publicDir,
32
+ });
33
+ (0, zephyr_edge_contract_1.ze_log)('Configuring with Zephyr...');
34
+ packageJson = await (0, zephyr_agent_1.getPackageJson)(vite_internal_options.root);
35
+ (0, zephyr_edge_contract_1.ze_log)('Loaded package.json.', packageJson);
36
+ if (!packageJson)
37
+ return (0, zephyr_edge_contract_1.ze_error)('ERR_PACKAGE_JSON_NOT_FOUND');
38
+ gitInfo = await (0, zephyr_agent_1.getGitInfo)();
39
+ (0, zephyr_edge_contract_1.ze_log)('Loaded Git Info.', gitInfo);
40
+ if (!gitInfo || !(gitInfo === null || gitInfo === void 0 ? void 0 : gitInfo.app.org) || !(gitInfo === null || gitInfo === void 0 ? void 0 : gitInfo.app.project))
41
+ return (0, zephyr_edge_contract_1.ze_error)('ERR_NO_GIT_INFO', 'Could not get git info. \n Can you confirm this directory has initialized as a git repository? ');
42
+ if (!(packageJson === null || packageJson === void 0 ? void 0 : packageJson.name))
43
+ return (0, zephyr_edge_contract_1.ze_error)('ERR_PACKAGE_JSON_MUST_HAVE_NAME_VERSION');
44
+ application_uid = (0, zephyr_edge_contract_1.createApplicationUID)({
45
+ org: gitInfo.app.org,
46
+ project: gitInfo.app.project,
47
+ name: packageJson === null || packageJson === void 0 ? void 0 : packageJson.name,
48
+ });
49
+ (0, zephyr_edge_contract_1.ze_log)('vite-zephyr-options', vite_internal_options);
50
+ },
51
+ transform: async (code, id) => {
52
+ const extractedRemotes = _options ? (0, remote_map_parser_1.parseRemoteMap)(code, id) : undefined;
53
+ if (extractedRemotes === undefined) {
54
+ return code;
55
+ }
56
+ const { remotesMap, startIndex, endIndex } = extractedRemotes;
57
+ const remotes = [];
58
+ for (const remote of remotesMap) {
59
+ const { name, entry, type } = remote;
60
+ (0, zephyr_edge_contract_1.ze_log)('Remote details:', JSON.stringify(remotesMap));
61
+ const remote_application_uuid = (0, zephyr_edge_contract_1.createApplicationUID)({
62
+ org: gitInfo.app.org,
63
+ project: gitInfo.app.project,
64
+ name: name,
65
+ });
66
+ (0, zephyr_edge_contract_1.ze_log)('Resolving remote:', remote_application_uuid, name);
67
+ const remoteDetails = await (0, resolve_remote_dependency_1.resolve_remote_dependency)({ name: remote_application_uuid, version: name });
68
+ (0, zephyr_edge_contract_1.ze_log)('Resolved remote:', remoteDetails);
69
+ if (!remoteDetails) {
70
+ continue;
71
+ }
72
+ const updatedUrl = (0, remote_map_parser_1.replaceProtocolAndHost)(entry, remoteDetails.remote_entry_url);
73
+ (0, zephyr_edge_contract_1.ze_log)('Updating remote url:', entry, 'to ->', updatedUrl);
74
+ remotes.push({
75
+ name,
76
+ type,
77
+ entryGlobalName: name,
78
+ entry: updatedUrl,
79
+ });
80
+ (0, zephyr_edge_contract_1.ze_log)('Updated remote url:', entry);
81
+ }
82
+ (0, zephyr_edge_contract_1.ze_log)('Writing remotesMap to bundle:', remotes);
83
+ return code.slice(0, startIndex) + JSON.stringify(remotes) + code.slice(endIndex);
84
+ },
85
+ closeBundle: async () => {
86
+ const publicAssets = [];
87
+ if (vite_internal_options.publicDir) {
88
+ const _public_assets = await (0, load_public_dir_1.load_public_dir)({
89
+ outDir: vite_internal_options.outDir,
90
+ publicDir: vite_internal_options.publicDir,
91
+ });
92
+ publicAssets.push(..._public_assets);
93
+ }
94
+ const _static_assets = await (0, load_static_entries_1.load_static_entries)({
95
+ root: vite_internal_options.root,
96
+ outDir: vite_internal_options.outDir,
97
+ });
98
+ publicAssets.push(..._static_assets);
99
+ const assets = Object.assign({}, ...publicAssets.map((asset) => ({ [asset.fileName]: asset })));
100
+ await _zephyr({ assets, vite_internal_options, application_uid, packageJson, gitInfo });
101
+ },
102
+ };
103
+ }
104
+ async function _zephyr(options) {
105
+ const { assets: _assets, vite_internal_options, application_uid, packageJson, gitInfo } = options;
106
+ (0, zephyr_edge_contract_1.ze_log)('Going to check auth token or get it...');
107
+ await (0, zephyr_agent_1.checkAuth)();
108
+ (0, zephyr_edge_contract_1.ze_log)('Got auth token, going to get application configuration and build id...');
109
+ const [appConfig, buildId, hash_set] = await Promise.all([
110
+ (0, zephyr_agent_1.getApplicationConfiguration)({ application_uid }),
111
+ (0, zephyr_agent_1.getBuildId)(application_uid),
112
+ (0, zephyr_agent_1.get_hash_list)(application_uid),
113
+ ]);
114
+ const { username, email, EDGE_URL } = appConfig;
115
+ (0, zephyr_edge_contract_1.ze_log)('Got application configuration', { username, email, EDGE_URL });
116
+ if (!buildId)
117
+ return (0, zephyr_edge_contract_1.ze_error)('ERR_GET_BUILD_ID');
118
+ const pluginOptions = {
119
+ pluginName: 'vite-plugin-zephyr',
120
+ application_uid,
121
+ buildEnv: 'local',
122
+ username,
123
+ app: {
124
+ name: packageJson.name,
125
+ version: packageJson.version,
126
+ org: gitInfo.app.org,
127
+ project: gitInfo.app.project,
128
+ },
129
+ git: gitInfo === null || gitInfo === void 0 ? void 0 : gitInfo.git,
130
+ isCI,
131
+ zeConfig: {
132
+ user: username,
133
+ edge_url: EDGE_URL,
134
+ buildId,
135
+ },
136
+ mfConfig: void 0,
137
+ };
138
+ (0, zephyr_edge_contract_1.ze_log)('\nzephyr agent started.\n');
139
+ const logEvent = (0, zephyr_agent_1.logger)(pluginOptions);
140
+ logEvent({
141
+ level: 'info',
142
+ action: 'build:info:user',
143
+ ignore: true,
144
+ message: `Hi ${(0, zephyr_edge_contract_1.cyanBright)(username)}!\n${(0, zephyr_edge_contract_1.white)(application_uid)}${(0, zephyr_edge_contract_1.yellow)(`#${buildId}`)}\n`,
145
+ });
146
+ const zeStart = Date.now();
147
+ const partialAssetMap = await (0, zephyr_edge_contract_1.getPartialAssetMap)(application_uid);
148
+ await (0, zephyr_edge_contract_1.removePartialAssetMap)(application_uid);
149
+ const assets = Object.assign({}, _assets, ...Object.values(partialAssetMap !== null && partialAssetMap !== void 0 ? partialAssetMap : {}));
150
+ const assetsMap = (0, zephyr_agent_1.buildAssetsMap)(assets, extractBuffer, getAssetType);
151
+ const missingAssets = (0, zephyr_agent_1.get_missing_assets)({ assetsMap, hash_set });
152
+ await (0, zephyr_agent_1.upload)({
153
+ pluginOptions,
154
+ assets: {
155
+ assetsMap,
156
+ missingAssets,
157
+ outputPath: vite_internal_options.outDir,
158
+ count: Object.keys(assets).length,
159
+ },
160
+ // @ts-expect-error TODO: fix this types to get legacy and current working
161
+ getDashData: zephyr_agent_1.zeGetDashData,
162
+ appConfig,
163
+ zeStart,
164
+ });
165
+ }
166
+ function extractBuffer(asset) {
167
+ switch (asset.type) {
168
+ case 'chunk':
169
+ return asset.code;
170
+ case 'asset':
171
+ return typeof asset.source === 'string' ? asset.source : new TextDecoder().decode(asset.source);
172
+ default:
173
+ return void 0;
174
+ }
175
+ }
176
+ function getAssetType(asset) {
177
+ return asset.type;
178
+ }
179
+ //# sourceMappingURL=vite-plugin-zephyr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite-plugin-zephyr.js","sourceRoot":"","sources":["../../src/lib/vite-plugin-zephyr.ts"],"names":[],"mappings":";;;;AAAA,oDAA8B;AAG9B,+CAasB;AACtB,+DAU8B;AAC9B,uDAAoD;AACpD,+DAA4D;AAE5D,2DAAkG;AAClG,2EAAwE;AACxE,kDAAqD;AAWrD,SAAgB,UAAU,CAAC,QAAkC;IAC3D,MAAM,QAAQ,GAAG,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,QAAQ,CAAC;IACpC,OAAO,QAAQ,CAAC,CAAC,CAAE,IAAA,iBAAU,EAAC,QAAQ,CAAc,CAAC,MAAM,CAAC,C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C;IAEnF,MAAM,SAAS,GAAG,IAAA,6BAAc,EAAC,MAAM,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;IACtE,MAAM,aAAa,GAAG,IAAA,iCAAkB,EAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;IAElE,MAAM,IAAA,qBAAM,EAAC;QACX,aAAa;QACb,MAAM,EAAE;YACN,SAAS;YACT,aAAa;YACb,UAAU,EAAE,qBAAqB,CAAC,MAAM;YACxC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM;SAClC;QACD,0EAA0E;QAC1E,WAAW,EAAE,4BAAa;QAC1B,SAAS;QACT,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AAED,SAAS,aAAa,CAAC,KAAgC;IACrD,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,OAAO;YACV,OAAO,KAAK,CAAC,IAAI,CAAC;QACpB,KAAK,OAAO;YACV,OAAO,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAClG;YACE,OAAO,KAAK,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,KAAgC;IACpD,OAAO,KAAK,CAAC,IAAI,CAAC;AACpB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export interface ZephyrInternalOptions {
2
+ root: string;
3
+ configFile: string;
4
+ outDir: string;
5
+ publicDir?: string;
6
+ dir?: string;
7
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=zephyr-internal-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zephyr-internal-options.js","sourceRoot":"","sources":["../../src/lib/zephyr-internal-options.ts"],"names":[],"mappings":""}
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "vite-plugin-zephyr",
3
+ "version": "0.0.26",
4
+ "license": "Apache-2.0",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "nx run vite-plugin-zephyr:build",
9
+ "patch-version": "pnpm version"
10
+ },
11
+ "dependencies": {
12
+ "@module-federation/runtime": "^0.6.10",
13
+ "@module-federation/vite": "^1.1.3",
14
+ "acorn": "^8.12.1",
15
+ "acorn-walk": "^8.3.4",
16
+ "is-ci": "^3",
17
+ "json5": "2.2.3",
18
+ "rollup": "^4.22.5",
19
+ "vite": "^5.4.8",
20
+ "zephyr-agent": "workspace:*",
21
+ "zephyr-edge-contract": "workspace:*"
22
+ },
23
+ "devDependencies": {
24
+ "@types/is-ci": "^3.0.4"
25
+ },
26
+ "type": "commonjs"
27
+ }
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "vite-plugin-zephyr",
3
+ "version": "0.0.0-canary-20241116123955",
4
+ "license": "Apache-2.0",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "dependencies": {
8
+ "@module-federation/runtime": "^0.6.10",
9
+ "@module-federation/vite": "^1.1.3",
10
+ "acorn": "^8.12.1",
11
+ "acorn-walk": "^8.3.4",
12
+ "is-ci": "^3",
13
+ "json5": "2.2.3",
14
+ "rollup": "^4.22.5",
15
+ "vite": "^5.4.8",
16
+ "zephyr-agent": "0.0.0-canary-20241116123955",
17
+ "zephyr-edge-contract": "0.0.0-canary-20241116123955"
18
+ },
19
+ "devDependencies": {
20
+ "@types/is-ci": "^3.0.4"
21
+ },
22
+ "scripts": {
23
+ "build": "nx run vite-plugin-zephyr:build",
24
+ "patch-version": "pnpm version"
25
+ }
26
+ }