rollup-plugin-zephyr 0.0.0-canary-20241121202227 → 0.0.0-canary-20241122011536

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,12 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.withZephyr = void 0;
4
- const tslib_1 = require("tslib");
5
- const isCI = tslib_1.__importStar(require("is-ci"));
6
4
  const zephyr_agent_1 = require("zephyr-agent");
7
- const zephyr_edge_contract_1 = require("zephyr-edge-contract");
8
- const get_assets_map_1 = require("./utils/get-assets-map");
9
- const get_dash_data_1 = require("./utils/get-dash-data");
5
+ const get_assets_map_1 = require("./transform/get-assets-map");
6
+ const node_process_1 = require("node:process");
10
7
  const getInputFolder = (options) => {
11
8
  if (typeof options.input === 'string')
12
9
  return options.input;
@@ -14,100 +11,24 @@ const getInputFolder = (options) => {
14
11
  return options.input[0];
15
12
  if (typeof options.input === 'object')
16
13
  return Object.values(options.input)[0];
17
- return process.cwd();
14
+ return (0, node_process_1.cwd)();
18
15
  };
19
16
  function withZephyr() {
20
- let _state;
17
+ const { zephyr_engine_defer, zephyr_defer_create } = zephyr_agent_1.ZephyrEngine.defer_create();
21
18
  return {
22
19
  name: 'with-zephyr',
23
20
  buildStart: async (options) => {
24
- _state = (async function zephyr_init() {
25
- (0, zephyr_edge_contract_1.ze_log)('Setting up zephyr agent configuration.');
26
- const _zephyrOptions = { wait_for_index_html: false };
27
- const path_to_execution_dir = getInputFolder(options);
28
- const [packageJson, gitInfo] = await Promise.all([(0, zephyr_agent_1.getPackageJson)(path_to_execution_dir), (0, zephyr_agent_1.getGitInfo)()]);
29
- const application_uid = (0, zephyr_edge_contract_1.createApplicationUID)({
30
- org: gitInfo.app.org,
31
- project: gitInfo.app.project,
32
- name: packageJson.name,
33
- });
34
- await (0, zephyr_agent_1.checkAuth)();
35
- const [appConfig, buildId, hash_set] = await Promise.all([
36
- (0, zephyr_agent_1.getApplicationConfiguration)({ application_uid }),
37
- (0, zephyr_agent_1.getBuildId)(application_uid),
38
- (0, zephyr_agent_1.get_hash_list)(application_uid),
39
- ]);
40
- const { username, email, EDGE_URL } = appConfig;
41
- (0, zephyr_edge_contract_1.ze_log)('Got application configuration: ', {
42
- username,
43
- email,
44
- EDGE_URL,
45
- });
46
- if (!buildId)
47
- return (0, zephyr_edge_contract_1.ze_error)('ERR_GET_BUILD_ID');
48
- (0, zephyr_edge_contract_1.ze_log)(`Got build id: ${buildId}`);
49
- const pluginOptions = {
50
- pluginName: 'rollup-plugin-zephyr',
51
- application_uid,
52
- buildEnv: 'local',
53
- username,
54
- app: {
55
- name: packageJson.name,
56
- version: packageJson.version,
57
- org: gitInfo.app.org,
58
- project: gitInfo.app.project,
59
- },
60
- git: gitInfo.git,
61
- isCI: isCI,
62
- zeConfig: {
63
- user: username,
64
- edge_url: EDGE_URL,
65
- buildId: buildId,
66
- },
67
- mfConfig: void 0,
68
- wait_for_index_html: _zephyrOptions === null || _zephyrOptions === void 0 ? void 0 : _zephyrOptions.wait_for_index_html,
69
- };
70
- const logEvent = (0, zephyr_agent_1.logger)(pluginOptions);
71
- logEvent({
72
- level: 'info',
73
- action: 'build:info:user',
74
- ignore: true,
75
- 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`,
76
- });
77
- return {
78
- appConfig,
79
- buildId,
80
- hash_set,
81
- pluginOptions,
82
- };
83
- })();
21
+ const path_to_execution_dir = getInputFolder(options);
22
+ zephyr_defer_create(path_to_execution_dir);
84
23
  },
85
24
  writeBundle: async (options, bundle) => {
86
- const zeStart = Date.now();
87
- await (async function zephyr_upload(props) {
88
- (0, zephyr_edge_contract_1.ze_log)('zephyr agent started...');
89
- const { state, bundle } = props;
90
- const _state = await state;
91
- if (!_state)
92
- return (0, zephyr_edge_contract_1.ze_error)('ERR_INITIALIZE_ZEPHYR_AGENT');
93
- const { appConfig, hash_set, pluginOptions } = _state;
94
- const assetsMap = (0, get_assets_map_1.getAssetsMap)(bundle);
95
- const missingAssets = (0, zephyr_agent_1.get_missing_assets)({ assetsMap, hash_set });
96
- await (0, zephyr_agent_1.upload)({
97
- pluginOptions,
98
- assets: {
99
- assetsMap,
100
- missingAssets,
101
- outputPath: options.dir,
102
- count: Object.keys(bundle).length,
103
- },
104
- // @ts-expect-error TODO: fix this types to get legacy and current working
105
- getDashData: get_dash_data_1.getDashData,
106
- appConfig,
107
- zeStart,
108
- });
109
- })({ state: _state, bundle });
110
- console.log('zephyr agent done in', Date.now() - zeStart, 'ms');
25
+ const zephyr_engine = await zephyr_engine_defer;
26
+ await zephyr_engine.start_new_build();
27
+ await zephyr_engine.upload_assets({
28
+ assetsMap: (0, get_assets_map_1.getAssetsMap)(bundle),
29
+ buildStats: await (0, zephyr_agent_1.zeBuildDashData)(zephyr_engine),
30
+ });
31
+ await zephyr_engine.build_finished();
111
32
  },
112
33
  };
113
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"rollup-plugin-zephyr.js","sourceRoot":"","sources":["../../src/lib/rollup-plugin-zephyr.ts"],"names":[],"mappings":";;;;AAAA,oDAA8B;AAE9B,+CAUsB;AACtB,+DAS8B;AAC9B,2DAAsD;AACtD,yDAAoD;AASpD,MAAM,cAAc,GAAG,CAAC,OAAqB,EAAU,EAAE;IACvD,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC,KAAK,CAAC;IAC5D,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1D,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9E,OAAO,OAA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yr-agent';
3
3
  export declare function getAssetsMap(assets: OutputBundle): ZeBuildAssetsMap;
@@ -11,7 +11,9 @@ const extractBuffer = (asset) => {
11
11
  case 'chunk':
12
12
  return asset.code;
13
13
  case 'asset':
14
- return typeof asset.source === 'string' ? asset.source : new TextDecoder().decode(asset.source);
14
+ return typeof asset.source === 'string'
15
+ ? asset.source
16
+ : new TextDecoder().decode(asset.source);
15
17
  default:
16
18
  return void 0;
17
19
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-assets-map.js","sourceRoot":"","sources":["../../../src/lib/transform/get-assets-map.ts"],"names":[],"mappings":";;;AACA,+CAAgE;AAEhE,SAAgB,YAAY,CAAC,MAAoB;IAC/C,OAAO,IAAA,6BAAc,EAAC,MAAM,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;AAC7D,CAAC;AAFD,oCAEC;AAED,MAAM,aAAa,GAAG,CAAC,KAAgC,EAAsB,EAAE;IAC7E,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;gBACrC,CAAC,CAAC,KAAK,CAAC,MAAM;gBACd,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7C;YACE,OAAO,KAAK,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,KAAgC,EAAU,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC"}
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup-plugin-zephyr",
3
- "version": "0.0.26",
3
+ "version": "0.0.30",
4
4
  "license": "Apache-2.0",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",
@@ -13,8 +13,7 @@
13
13
  "is-ci": "^3.0.1",
14
14
  "rollup": "^4",
15
15
  "tslib": "^2",
16
- "zephyr-agent": "workspace:*",
17
- "zephyr-edge-contract": "workspace:*"
16
+ "zephyr-agent": "workspace:*"
18
17
  },
19
18
  "keywords": [
20
19
  "rollup",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup-plugin-zephyr",
3
- "version": "0.0.0-canary-20241121202227",
3
+ "version": "0.0.0-canary-20241122011536",
4
4
  "license": "Apache-2.0",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",
@@ -9,8 +9,7 @@
9
9
  "is-ci": "^3.0.1",
10
10
  "rollup": "^4",
11
11
  "tslib": "^2",
12
- "zephyr-agent": "0.0.0-canary-20241121202227",
13
- "zephyr-edge-contract": "0.0.0-canary-20241121202227"
12
+ "zephyr-agent": "0.0.0-canary-20241122011536"
14
13
  },
15
14
  "keywords": [
16
15
  "rollup",
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-assets-map.js","sourceRoot":"","sources":["../../../src/lib/utils/get-assets-map.ts"],"names":[],"mappings":";;;AACA,+CAA8C;AAG9C,SAAgB,YAAY,CAAC,MAAoB;IAC/C,OAAO,IAAA,6BAAc,EAAC,MAAM,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;AAC7D,CAAC;AAFD,oCAEC;AAED,MAAM,aAAa,GAAG,CAAC,KAAgC,EAAsB,EAAE;IAC7E,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,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,KAAgC,EAAU,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC"}
@@ -1,39 +0,0 @@
1
- import { ZeApplicationConfig, ZephyrPluginOptions } from 'zephyr-edge-contract';
2
- interface GetDashDataOptions {
3
- appConfig: ZeApplicationConfig;
4
- pluginOptions: ZephyrPluginOptions;
5
- }
6
- export declare function getDashData({ pluginOptions, appConfig }: GetDashDataOptions): {
7
- id: string;
8
- name: string;
9
- environment: string;
10
- edge: {
11
- url: string;
12
- };
13
- app: {
14
- org: string;
15
- project: string;
16
- name: string;
17
- version: string;
18
- } & {
19
- buildId: string;
20
- };
21
- version: string;
22
- git: {
23
- name: string;
24
- email: string;
25
- branch: string;
26
- commit: string;
27
- };
28
- context: {
29
- isCI: boolean;
30
- };
31
- dependencies: never[];
32
- devDependencies: never[];
33
- optionalDependencies: never[];
34
- metadata: {};
35
- overrides: never[];
36
- consumes: never[];
37
- modules: never[];
38
- };
39
- export {};
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDashData = void 0;
4
- const zephyr_agent_1 = require("zephyr-agent");
5
- function getDashData({ pluginOptions, appConfig }) {
6
- return (0, zephyr_agent_1.zeGetDashData)({ pluginOptions, appConfig });
7
- }
8
- exports.getDashData = getDashData;
9
- //# sourceMappingURL=get-dash-data.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-dash-data.js","sourceRoot":"","sources":["../../../src/lib/utils/get-dash-data.ts"],"names":[],"mappings":";;;AACA,+CAA6C;AAO7C,SAAgB,WAAW,CAAC,EAAE,aAAa,EAAE,SAAS,EAAsB;IAC1E,OAAO,IAAA,4BAAa,EAAC,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC,CAAC;AACrD,CAAC;AAFD,kCAEC"}