@voryx/vc 1.0.0

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 ADDED
@@ -0,0 +1,48 @@
1
+ # @voryx/vc
2
+
3
+
4
+ A Voryx CLI tool for building and bundling libraries.
5
+
6
+
7
+ ## Configuration
8
+
9
+ ### `VCConfig` Options
10
+ - `target` (`EcmaScriptVersion`): The target environment for the library. Default: `'ESNext'`.
11
+ - `bundle` (`boolean`): Whether to bundle the library for distribution. Default: `false`.
12
+ - `emitDeclaration` (`boolean`): Whether to generate TypeScript declaration files. Default: `true`.
13
+ - `entryPoint` (`string | string[]`): The entry point of the library. Default: `'./src'`.
14
+ - `outDir` (`string`): The output directory for the built library. Default: `'./dist'`.
15
+ - `include` (`string[]`): Files to include in the build. Default: `undefined`.
16
+ - `exclude` (`string[]`): Files to exclude from the build. Default: `undefined`.
17
+ - `browser` (`boolean`): Whether to build for browser environments. Default: `false`.
18
+
19
+
20
+ ## Usage
21
+
22
+
23
+ ### Config File `./vc.config.js`:
24
+ ```javascript
25
+
26
+ /** @type {import('@voryx/vc').VCConfig} */
27
+ const config = {
28
+ bundle: true,
29
+ emitDeclaration: true
30
+ }
31
+
32
+ export default config
33
+ ```
34
+
35
+
36
+ ### Commands:
37
+
38
+
39
+ build the library for distribution:
40
+ ```bash
41
+ vc build
42
+ ```
43
+
44
+
45
+ build and watch for changes:
46
+ ```bash
47
+ vc build --watch
48
+ ```
package/dist/131.js ADDED
@@ -0,0 +1,101 @@
1
+ import * as __rspack_external__rslib_core_68de5877 from "@rslib/core";
2
+ import { __webpack_require__ } from "./rslib-runtime.js";
3
+ __webpack_require__.add({
4
+ "./src/index.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
5
+ __webpack_require__.r(__webpack_exports__);
6
+ __webpack_require__.d(__webpack_exports__, {
7
+ build: ()=>build,
8
+ loadVCConfig: ()=>loadVCConfig
9
+ });
10
+ var _rslib_core__rspack_import_0 = __webpack_require__("@rslib/core");
11
+ async function loadVCConfig(configPath) {
12
+ let config = {};
13
+ try {
14
+ config = await import(configPath);
15
+ if (config.bundle) {
16
+ if (!config.entryPoint) config.entryPoint = 'src/index.ts';
17
+ } else if (!config.entryPoint) config.entryPoint = 'src';
18
+ return {
19
+ bundle: config.bundle || false,
20
+ target: config.target || 'ESNext',
21
+ entryPoint: config.entryPoint,
22
+ outDir: config.outDir || 'dist',
23
+ emitDeclaration: false !== config.emitDeclaration,
24
+ browser: config.browser || false,
25
+ include: config.include,
26
+ exclude: config.exclude
27
+ };
28
+ } catch (err) {
29
+ return {
30
+ bundle: false,
31
+ target: 'ESNext',
32
+ entryPoint: 'src',
33
+ outDir: 'dist',
34
+ emitDeclaration: true,
35
+ browser: false
36
+ };
37
+ }
38
+ }
39
+ function vcToRslibConfig(config) {
40
+ const rsLibConfig = {
41
+ lib: [
42
+ {
43
+ format: 'esm',
44
+ syntax: config.target.toLowerCase() || 'esnext',
45
+ bundle: config.bundle || false,
46
+ dts: false !== config.emitDeclaration
47
+ }
48
+ ],
49
+ output: {
50
+ target: config.browser ? 'web' : 'node',
51
+ distPath: config.outDir
52
+ }
53
+ };
54
+ if (config.bundle) {
55
+ if ('string' == typeof config.entryPoint) rsLibConfig.source = {
56
+ entry: {
57
+ index: config.entryPoint
58
+ }
59
+ };
60
+ else if (Array.isArray(config.entryPoint)) {
61
+ const entry = {};
62
+ for (const entryPoint of config.entryPoint){
63
+ const name = entryPoint.split('/').slice(-1)[0].replace(/\.[^/.]+$/, '');
64
+ entry[name] = entryPoint;
65
+ }
66
+ rsLibConfig.source = {
67
+ entry
68
+ };
69
+ }
70
+ } else {
71
+ rsLibConfig.source = {
72
+ entry: {
73
+ index: `${config.entryPoint}/**`
74
+ }
75
+ };
76
+ rsLibConfig.lib[0].outBase = config.entryPoint;
77
+ }
78
+ if (config.include) rsLibConfig.source.include = config.include;
79
+ if (config.exclude) rsLibConfig.source.exclude = config.exclude;
80
+ return rsLibConfig;
81
+ }
82
+ async function build(options) {
83
+ let { cwd, config, watch } = options;
84
+ if ('string' == typeof config) config = await loadVCConfig(config);
85
+ const rsLibConfig = vcToRslibConfig(config);
86
+ const rslib = await (0, _rslib_core__rspack_import_0.createRslib)({
87
+ cwd,
88
+ config: rsLibConfig
89
+ });
90
+ await rslib.build({
91
+ watch: watch
92
+ });
93
+ }
94
+ },
95
+ "@rslib/core" (module) {
96
+ module.exports = __rspack_external__rslib_core_68de5877;
97
+ }
98
+ });
99
+ const src = __webpack_require__("./src/index.ts");
100
+ src.build;
101
+ src.loadVCConfig;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":""}
package/dist/build.js ADDED
@@ -0,0 +1,49 @@
1
+ import * as __rspack_external__voryx_cli_f0a3e044 from "@voryx/cli";
2
+ import * as __rspack_external_path from "path";
3
+ import { __webpack_require__ } from "./rslib-runtime.js";
4
+ import "./131.js";
5
+ __webpack_require__.add({
6
+ "./src/build.ts" (module, __webpack_exports__, __webpack_require__) {
7
+ __webpack_require__.a(module, async function(__rspack_load_async_deps, __rspack_async_done) {
8
+ try {
9
+ __webpack_require__.r(__webpack_exports__);
10
+ var _voryx_cli__rspack_import_0 = __webpack_require__("@voryx/cli");
11
+ var _index__rspack_import_2 = __webpack_require__("./src/index.ts");
12
+ var path__rspack_import_1 = __webpack_require__("path");
13
+ const cli = new _voryx_cli__rspack_import_0.Cli('vc');
14
+ new cli.Command({
15
+ name: 'build',
16
+ description: 'Build the project',
17
+ usage: 'vc build [options]',
18
+ schema: {
19
+ watch: new _voryx_cli__rspack_import_0.BooleanFlag({
20
+ description: 'Watch for file changes and rebuild automatically',
21
+ short: 'w',
22
+ default: false
23
+ })
24
+ },
25
+ async run ({ flags }) {
26
+ const cwd = process.cwd();
27
+ const configPath = path__rspack_import_1.join(cwd, 'vc.config.js');
28
+ await (0, _index__rspack_import_2.build)({
29
+ cwd,
30
+ config: configPath,
31
+ watch: flags.watch
32
+ });
33
+ }
34
+ });
35
+ await cli.run();
36
+ __rspack_async_done();
37
+ } catch (e) {
38
+ __rspack_async_done(e);
39
+ }
40
+ }, 1);
41
+ },
42
+ "@voryx/cli" (module) {
43
+ module.exports = __rspack_external__voryx_cli_f0a3e044;
44
+ },
45
+ path (module) {
46
+ module.exports = __rspack_external_path;
47
+ }
48
+ });
49
+ __webpack_require__("./src/build.ts");
@@ -0,0 +1,25 @@
1
+ export type EcmaScriptVersion = 'ES5' | 'ES6' | 'ES2015' | 'ES2016' | 'ES2017' | 'ES2018' | 'ES2019' | 'ES2020' | 'ES2021' | 'ES2022' | 'ES2023' | 'ES2024' | 'ESNext';
2
+ export interface VCConfig {
3
+ bundle?: boolean;
4
+ target?: EcmaScriptVersion;
5
+ entryPoint?: string | string[];
6
+ outDir?: string;
7
+ emitDeclaration?: boolean;
8
+ include?: string[];
9
+ exclude?: string[];
10
+ browser?: boolean;
11
+ }
12
+ export declare function loadVCConfig(configPath: string): Promise<Required<Omit<VCConfig, 'include' | 'exclude'>> & {
13
+ include?: string[];
14
+ exclude?: string[];
15
+ }>;
16
+ export interface BuildOptions {
17
+ cwd: string;
18
+ config: string | (Required<Omit<VCConfig, 'include' | 'exclude'>> & {
19
+ include?: string[];
20
+ exclude?: string[];
21
+ });
22
+ watch?: boolean;
23
+ }
24
+ export declare function build(options: BuildOptions): Promise<void>;
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,iBAAiB,GACzB,KAAK,GACL,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,QAAQ,CAAA;AAEZ,MAAM,WAAW,QAAQ;IACvB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,MAAM,CAAC,EAAE,iBAAiB,CAAA;IAC1B,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAsB,YAAY,CAChC,UAAU,EAAE,MAAM,GACjB,OAAO,CACR,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC,GAAG;IAChD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB,CACF,CAkCA;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EACF,MAAM,GACN,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC,GAAG;QACjD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;KACnB,CAAC,CAAA;IACN,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAkED,wBAAsB,KAAK,CAAE,OAAO,EAAE,YAAY,iBAiBjD"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ import "./131.js";
2
+ export { build, loadVCConfig };
@@ -0,0 +1,29 @@
1
+ {
2
+ "allFiles": [
3
+ "build.js",
4
+ "index.js",
5
+ "rslib-runtime.js",
6
+ "131.js"
7
+ ],
8
+ "entries": {
9
+ "build": {
10
+ "initial": {
11
+ "js": [
12
+ "rslib-runtime.js",
13
+ "131.js",
14
+ "build.js"
15
+ ]
16
+ }
17
+ },
18
+ "index": {
19
+ "initial": {
20
+ "js": [
21
+ "rslib-runtime.js",
22
+ "131.js",
23
+ "index.js"
24
+ ]
25
+ }
26
+ }
27
+ },
28
+ "integrity": {}
29
+ }
@@ -0,0 +1,129 @@
1
+ var __webpack_modules__ = {};
2
+ var __webpack_module_cache__ = {};
3
+ function __webpack_require__(moduleId) {
4
+ var cachedModule = __webpack_module_cache__[moduleId];
5
+ if (void 0 !== cachedModule) return cachedModule.exports;
6
+ var module = __webpack_module_cache__[moduleId] = {
7
+ exports: {}
8
+ };
9
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
10
+ return module.exports;
11
+ }
12
+ __webpack_require__.m = __webpack_modules__;
13
+ (()=>{
14
+ __webpack_require__.add = function(modules) {
15
+ Object.assign(__webpack_require__.m, modules);
16
+ };
17
+ })();
18
+ (()=>{
19
+ var hasSymbol = "function" == typeof Symbol;
20
+ var rspackQueues = hasSymbol ? Symbol("rspack queues") : "__rspack_queues";
21
+ var rspackExports = __webpack_require__.aE = hasSymbol ? Symbol("rspack exports") : "__webpack_exports__";
22
+ var rspackError = hasSymbol ? Symbol("rspack error") : "__rspack_error";
23
+ var rspackDone = hasSymbol ? Symbol("rspack done") : "__rspack_done";
24
+ var rspackDefer = __webpack_require__.zS = hasSymbol ? Symbol("rspack defer") : "__rspack_defer";
25
+ var resolveQueue = (queue)=>{
26
+ if (queue && queue.d < 1) {
27
+ queue.d = 1;
28
+ queue.forEach((fn)=>fn.r--);
29
+ queue.forEach((fn)=>fn.r-- ? fn.r++ : fn());
30
+ }
31
+ };
32
+ var wrapDeps = (deps)=>deps.map((dep)=>{
33
+ if (null !== dep && "object" == typeof dep) {
34
+ if (!dep[rspackQueues] && dep[rspackDefer]) {
35
+ var asyncDeps = dep[rspackDefer];
36
+ var hasUnresolvedAsyncSubgraph = asyncDeps.some((id)=>{
37
+ var cache = __webpack_module_cache__[id];
38
+ return !cache || false === cache[rspackDone];
39
+ });
40
+ if (!hasUnresolvedAsyncSubgraph) return dep;
41
+ var d = dep;
42
+ dep = {
43
+ then (callback) {
44
+ Promise.all(asyncDeps.map(__webpack_require__)).then(()=>callback(d));
45
+ }
46
+ };
47
+ }
48
+ if (dep[rspackQueues]) return dep;
49
+ if (dep.then) {
50
+ var queue = [];
51
+ queue.d = 0;
52
+ dep.then((r)=>{
53
+ obj[rspackExports] = r;
54
+ resolveQueue(queue);
55
+ }, (e)=>{
56
+ obj[rspackError] = e;
57
+ resolveQueue(queue);
58
+ });
59
+ var obj = {};
60
+ obj[rspackDefer] = false;
61
+ obj[rspackQueues] = (fn)=>fn(queue);
62
+ return obj;
63
+ }
64
+ }
65
+ var ret = {};
66
+ ret[rspackQueues] = ()=>{};
67
+ ret[rspackExports] = dep;
68
+ return ret;
69
+ });
70
+ __webpack_require__.a = (module, body, hasAwait)=>{
71
+ var queue;
72
+ hasAwait && ((queue = []).d = -1);
73
+ var depQueues = new Set();
74
+ var exports = module.exports;
75
+ var currentDeps;
76
+ var outerResolve;
77
+ var reject;
78
+ var promise = new Promise((resolve, rej)=>{
79
+ reject = rej;
80
+ outerResolve = resolve;
81
+ });
82
+ promise[rspackExports] = exports;
83
+ promise[rspackQueues] = (fn)=>{
84
+ queue && fn(queue), depQueues.forEach(fn), promise["catch"](()=>{});
85
+ };
86
+ module.exports = promise;
87
+ var handle = (deps)=>{
88
+ currentDeps = wrapDeps(deps);
89
+ var fn;
90
+ var getResult = ()=>currentDeps.map((d)=>{
91
+ if (d[rspackDefer]) return d;
92
+ if (d[rspackError]) throw d[rspackError];
93
+ return d[rspackExports];
94
+ });
95
+ var promise = new Promise((resolve)=>{
96
+ fn = ()=>resolve(getResult);
97
+ fn.r = 0;
98
+ var fnQueue = (q)=>q !== queue && !depQueues.has(q) && (depQueues.add(q), q && !q.d && (fn.r++, q.push(fn)));
99
+ currentDeps.map((dep)=>dep[rspackDefer] || dep[rspackQueues](fnQueue));
100
+ });
101
+ return fn.r ? promise : getResult();
102
+ };
103
+ var done = (err)=>(err ? reject(promise[rspackError] = err) : outerResolve(exports), resolveQueue(queue), promise[rspackDone] = true);
104
+ body(handle, done);
105
+ queue && queue.d < 0 && (queue.d = 0);
106
+ };
107
+ })();
108
+ (()=>{
109
+ __webpack_require__.d = (exports, definition)=>{
110
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
111
+ enumerable: true,
112
+ get: definition[key]
113
+ });
114
+ };
115
+ })();
116
+ (()=>{
117
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
118
+ })();
119
+ (()=>{
120
+ __webpack_require__.r = (exports)=>{
121
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
122
+ value: 'Module'
123
+ });
124
+ Object.defineProperty(exports, '__esModule', {
125
+ value: true
126
+ });
127
+ };
128
+ })();
129
+ export { __webpack_require__ };
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@voryx/vc",
3
+ "version": "1.0.0",
4
+ "description": "A Voryx CLI tool for building and managing projects.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "main": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "import": "./dist/index.js",
19
+ "types": "./dist/index.d.ts"
20
+ }
21
+ },
22
+ "bin": {
23
+ "vc": "./dist/build.js"
24
+ },
25
+ "dependencies": {
26
+ "@rslib/core": "^0.19.6",
27
+ "@voryx/cli": "0.0.0"
28
+ },
29
+ "devDependencies": {
30
+ "@types/node": "^25.2.3",
31
+ "ts-standard": "^12.0.2",
32
+ "typescript": "^5.9.3",
33
+ "@voryx/tsconfig": "0.0.0"
34
+ },
35
+ "scripts": {
36
+ "build": "rslib build",
37
+ "lint": "ts-standard"
38
+ }
39
+ }