zephyr-rolldown-plugin 0.0.0-canary-20250221234130
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/LICENSE +39 -0
- package/README.md +34 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/internal/get-assets-map.d.ts +3 -0
- package/dist/lib/internal/get-assets-map.js +21 -0
- package/dist/lib/internal/get-assets-map.js.map +1 -0
- package/dist/lib/zephyr-rolldown-plugin.d.ts +6 -0
- package/dist/lib/zephyr-rolldown-plugin.js +38 -0
- package/dist/lib/zephyr-rolldown-plugin.js.map +1 -0
- package/dist/package.json +20 -0
- package/package.json +19 -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,34 @@
|
|
|
1
|
+
# Zephyr Rolldown Plugin (WIP)
|
|
2
|
+
|
|
3
|
+
## Usage
|
|
4
|
+
|
|
5
|
+
```javascript
|
|
6
|
+
// rolldown.config.mjs
|
|
7
|
+
import { defineConfig } from 'rolldown';
|
|
8
|
+
import { withZephyr } from 'zephyr-rolldown-plugin';
|
|
9
|
+
|
|
10
|
+
export default defineConfig({
|
|
11
|
+
input: 'src/main.tsx',
|
|
12
|
+
plugins: [
|
|
13
|
+
{
|
|
14
|
+
name: 'emit-html',
|
|
15
|
+
generateBundle() {
|
|
16
|
+
const html = `
|
|
17
|
+
<html>
|
|
18
|
+
<body>
|
|
19
|
+
<div id="root"></div>
|
|
20
|
+
<script type="module" src="./main.js"></script>
|
|
21
|
+
</body>
|
|
22
|
+
</html>
|
|
23
|
+
`;
|
|
24
|
+
this.emitFile({
|
|
25
|
+
type: 'asset',
|
|
26
|
+
fileName: 'index.html',
|
|
27
|
+
source: html,
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
withZephyr(),
|
|
32
|
+
],
|
|
33
|
+
});
|
|
34
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { withZephyr } from './lib/zephyr-rolldown-plugin';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withZephyr = void 0;
|
|
4
|
+
var zephyr_rolldown_plugin_1 = require("./lib/zephyr-rolldown-plugin");
|
|
5
|
+
Object.defineProperty(exports, "withZephyr", { enumerable: true, get: function () { return zephyr_rolldown_plugin_1.withZephyr; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uEAA0D;AAAjD,oHAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAssetsMap = getAssetsMap;
|
|
4
|
+
const zephyr_agent_1 = require("zephyr-agent");
|
|
5
|
+
function getAssetsMap(assets) {
|
|
6
|
+
return (0, zephyr_agent_1.buildAssetsMap)(assets, extractBuffer, getAssetType);
|
|
7
|
+
}
|
|
8
|
+
const extractBuffer = (asset) => {
|
|
9
|
+
switch (asset.type) {
|
|
10
|
+
case 'chunk':
|
|
11
|
+
return asset.code;
|
|
12
|
+
case 'asset':
|
|
13
|
+
return typeof asset.source === 'string'
|
|
14
|
+
? asset.source
|
|
15
|
+
: new TextDecoder().decode(asset.source);
|
|
16
|
+
default:
|
|
17
|
+
return void 0;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const getAssetType = (asset) => asset.type;
|
|
21
|
+
//# sourceMappingURL=get-assets-map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-assets-map.js","sourceRoot":"","sources":["../../../src/lib/internal/get-assets-map.ts"],"names":[],"mappings":";;AAGA,oCAEC;AAJD,+CAAgE;AAEhE,SAAgB,YAAY,CAAC,MAAoB;IAC/C,OAAO,IAAA,6BAAc,EAAC,MAAM,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;AAC7D,CAAC;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"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { InputOptions, NormalizedOutputOptions, OutputBundle } from 'rolldown';
|
|
2
|
+
export declare function withZephyr(): {
|
|
3
|
+
name: string;
|
|
4
|
+
buildStart: (options: InputOptions) => Promise<void>;
|
|
5
|
+
writeBundle: (options: NormalizedOutputOptions, bundle: OutputBundle) => Promise<void>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withZephyr = withZephyr;
|
|
4
|
+
const zephyr_agent_1 = require("zephyr-agent");
|
|
5
|
+
const node_process_1 = require("node:process");
|
|
6
|
+
const get_assets_map_1 = require("./internal/get-assets-map");
|
|
7
|
+
const getInputFolder = (options) => {
|
|
8
|
+
if (typeof options.input === 'string')
|
|
9
|
+
return options.input;
|
|
10
|
+
if (Array.isArray(options.input))
|
|
11
|
+
return options.input[0];
|
|
12
|
+
if (typeof options.input === 'object')
|
|
13
|
+
return Object.values(options.input)[0];
|
|
14
|
+
return (0, node_process_1.cwd)();
|
|
15
|
+
};
|
|
16
|
+
function withZephyr() {
|
|
17
|
+
const { zephyr_engine_defer, zephyr_defer_create } = zephyr_agent_1.ZephyrEngine.defer_create();
|
|
18
|
+
return {
|
|
19
|
+
name: 'with-zephyr',
|
|
20
|
+
buildStart: async (options) => {
|
|
21
|
+
const path_to_execution_dir = getInputFolder(options);
|
|
22
|
+
zephyr_defer_create({
|
|
23
|
+
builder: 'rollup', //TODO(Nestor): API is the same, but we should make it explicit.
|
|
24
|
+
context: path_to_execution_dir,
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
writeBundle: async (options, bundle) => {
|
|
28
|
+
const zephyr_engine = await zephyr_engine_defer;
|
|
29
|
+
await zephyr_engine.start_new_build();
|
|
30
|
+
await zephyr_engine.upload_assets({
|
|
31
|
+
assetsMap: (0, get_assets_map_1.getAssetsMap)(bundle),
|
|
32
|
+
buildStats: await (0, zephyr_agent_1.zeBuildDashData)(zephyr_engine),
|
|
33
|
+
});
|
|
34
|
+
await zephyr_engine.build_finished();
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=zephyr-rolldown-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zephyr-rolldown-plugin.js","sourceRoot":"","sources":["../../src/lib/zephyr-rolldown-plugin.ts"],"names":[],"mappings":";;AAYA,gCAsBC;AAjCD,+CAA6D;AAC7D,+CAAmC;AACnC,8DAAyD;AAEzD,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,IAAA,kBAAG,GAAE,CAAC;AACf,CAAC,CAAC;AAEF,SAAgB,UAAU;IACxB,MAAM,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,GAAG,2BAAY,CAAC,YAAY,EAAE,CAAC;IAEjF,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,UAAU,EAAE,KAAK,EAAE,OAAqB,EAAE,EAAE;YAC1C,MAAM,qBAAqB,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;YACtD,mBAAmB,CAAC;gBAClB,OAAO,EAAE,QAAQ,EAAE,gEAAgE;gBACnF,OAAO,EAAE,qBAAqB;aAC/B,CAAC,CAAC;QACL,CAAC;QACD,WAAW,EAAE,KAAK,EAAE,OAAgC,EAAE,MAAoB,EAAE,EAAE;YAC5E,MAAM,aAAa,GAAG,MAAM,mBAAmB,CAAC;YAChD,MAAM,aAAa,CAAC,eAAe,EAAE,CAAC;YACtC,MAAM,aAAa,CAAC,aAAa,CAAC;gBAChC,SAAS,EAAE,IAAA,6BAAY,EAAC,MAAM,CAAC;gBAC/B,UAAU,EAAE,MAAM,IAAA,8BAAe,EAAC,aAAa,CAAC;aACjD,CAAC,CAAC;YACH,MAAM,aAAa,CAAC,cAAc,EAAE,CAAC;QACvC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "zephyr-rolldown-plugin",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "nx run zephyr-rolldown-plugin:build",
|
|
9
|
+
"patch-version": "pnpm version"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"is-ci": "^3",
|
|
13
|
+
"zephyr-agent": "workspace:*",
|
|
14
|
+
"rolldown": "1.0.0-beta.3"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/is-ci": "^3.0.4"
|
|
18
|
+
},
|
|
19
|
+
"type": "commonjs"
|
|
20
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "zephyr-rolldown-plugin",
|
|
3
|
+
"version": "0.0.0-canary-20250221234130",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"is-ci": "^3",
|
|
9
|
+
"rolldown": "1.0.0-beta.3",
|
|
10
|
+
"zephyr-agent": "0.0.34"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@types/is-ci": "^3.0.4"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "nx run zephyr-rolldown-plugin:build",
|
|
17
|
+
"patch-version": "pnpm version"
|
|
18
|
+
}
|
|
19
|
+
}
|