@seyuna/cli 1.0.0-canary.2 → 1.0.0-canary.21
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 +21 -0
- package/README.md +1 -0
- package/esm/_dnt.polyfills.d.ts +101 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -0
- package/esm/_dnt.polyfills.js +127 -0
- package/esm/_dnt.shims.d.ts +6 -0
- package/esm/_dnt.shims.d.ts.map +1 -0
- package/esm/_dnt.shims.js +61 -0
- package/esm/deno.d.ts +27 -0
- package/esm/deno.d.ts.map +1 -0
- package/esm/deno.js +30 -0
- package/esm/package.json +3 -0
- package/esm/src/config/init.d.ts +8 -0
- package/esm/src/config/init.d.ts.map +1 -0
- package/esm/src/config/init.js +68 -0
- package/esm/src/config/types.d.ts +25 -0
- package/esm/src/config/types.d.ts.map +1 -0
- package/esm/src/config/types.js +18 -0
- package/esm/src/helpers/cli.d.ts +45 -0
- package/esm/src/helpers/cli.d.ts.map +1 -0
- package/esm/src/helpers/cli.js +72 -0
- package/esm/src/helpers/fs.d.ts +35 -0
- package/esm/src/helpers/fs.d.ts.map +1 -0
- package/esm/src/helpers/fs.js +83 -0
- package/esm/src/helpers/styles.d.ts +54 -0
- package/esm/src/helpers/styles.d.ts.map +1 -0
- package/esm/src/helpers/styles.js +71 -0
- package/esm/src/main.d.ts +11 -0
- package/esm/src/main.d.ts.map +1 -0
- package/esm/src/main.js +110 -0
- package/esm/src/ui/compile.d.ts +21 -0
- package/esm/src/ui/compile.d.ts.map +1 -0
- package/esm/src/ui/compile.js +193 -0
- package/esm/src/ui/default.d.ts +8 -0
- package/esm/src/ui/default.d.ts.map +1 -0
- package/esm/src/ui/default.js +65 -0
- package/esm/src/ui/global.css.d.ts +11 -0
- package/esm/src/ui/global.css.d.ts.map +1 -0
- package/esm/src/ui/global.css.js +104 -0
- package/esm/src/ui/types.d.ts +77 -0
- package/esm/src/ui/types.d.ts.map +1 -0
- package/esm/src/ui/types.js +41 -0
- package/package.json +32 -18
- package/bin/seyuna.js +0 -10
- package/install.js +0 -42
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Seyuna
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# seyuna-cli
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
|
|
3
|
+
* but instead of using npm to install additional dependencies,
|
|
4
|
+
* this approach manually consolidates cjs/mjs/d.ts into a single file.
|
|
5
|
+
*
|
|
6
|
+
* Note that this code might be imported multiple times
|
|
7
|
+
* (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
|
|
8
|
+
* or Node.js might dynamically clear the cache and then force a require).
|
|
9
|
+
* Therefore, it's important to avoid redundant writes to global objects.
|
|
10
|
+
* Additionally, consider that commonjs is used alongside esm,
|
|
11
|
+
* so the two ponyfill functions are stored independently in two separate global objects.
|
|
12
|
+
*/
|
|
13
|
+
import { createRequire } from "node:module";
|
|
14
|
+
import { type URL } from "node:url";
|
|
15
|
+
declare global {
|
|
16
|
+
interface ImportMeta {
|
|
17
|
+
/** A string representation of the fully qualified module URL. When the
|
|
18
|
+
* module is loaded locally, the value will be a file URL (e.g.
|
|
19
|
+
* `file:///path/module.ts`).
|
|
20
|
+
*
|
|
21
|
+
* You can also parse the string as a URL to determine more information about
|
|
22
|
+
* how the current module was loaded. For example to determine if a module was
|
|
23
|
+
* local or not:
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* const url = new URL(import.meta.url);
|
|
27
|
+
* if (url.protocol === "file:") {
|
|
28
|
+
* console.log("this module was loaded locally");
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
url: string;
|
|
33
|
+
/**
|
|
34
|
+
* A function that returns resolved specifier as if it would be imported
|
|
35
|
+
* using `import(specifier)`.
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* console.log(import.meta.resolve("./foo.js"));
|
|
39
|
+
* // file:///dev/foo.js
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @param specifier The module specifier to resolve relative to `parent`.
|
|
43
|
+
* @param parent The absolute parent module URL to resolve from.
|
|
44
|
+
* @returns The absolute (`file:`) URL string for the resolved module.
|
|
45
|
+
*/
|
|
46
|
+
resolve(specifier: string, parent?: string | URL | undefined): string;
|
|
47
|
+
/** A flag that indicates if the current module is the main module that was
|
|
48
|
+
* called when starting the program under Deno.
|
|
49
|
+
*
|
|
50
|
+
* ```ts
|
|
51
|
+
* if (import.meta.main) {
|
|
52
|
+
* // this was loaded as the main module, maybe do some bootstrapping
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
main: boolean;
|
|
57
|
+
/** The absolute path of the current module.
|
|
58
|
+
*
|
|
59
|
+
* This property is only provided for local modules (ie. using `file://` URLs).
|
|
60
|
+
*
|
|
61
|
+
* Example:
|
|
62
|
+
* ```
|
|
63
|
+
* // Unix
|
|
64
|
+
* console.log(import.meta.filename); // /home/alice/my_module.ts
|
|
65
|
+
*
|
|
66
|
+
* // Windows
|
|
67
|
+
* console.log(import.meta.filename); // C:\alice\my_module.ts
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
filename: string;
|
|
71
|
+
/** The absolute path of the directory containing the current module.
|
|
72
|
+
*
|
|
73
|
+
* This property is only provided for local modules (ie. using `file://` URLs).
|
|
74
|
+
*
|
|
75
|
+
* * Example:
|
|
76
|
+
* ```
|
|
77
|
+
* // Unix
|
|
78
|
+
* console.log(import.meta.dirname); // /home/alice
|
|
79
|
+
*
|
|
80
|
+
* // Windows
|
|
81
|
+
* console.log(import.meta.dirname); // C:\alice
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
dirname: string;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
type NodeRequest = ReturnType<typeof createRequire>;
|
|
88
|
+
type NodeModule = NonNullable<NodeRequest["main"]>;
|
|
89
|
+
interface ImportMetaPonyfillCommonjs {
|
|
90
|
+
(require: NodeRequest, module: NodeModule): ImportMeta;
|
|
91
|
+
}
|
|
92
|
+
interface ImportMetaPonyfillEsmodule {
|
|
93
|
+
(importMeta: ImportMeta): ImportMeta;
|
|
94
|
+
}
|
|
95
|
+
interface ImportMetaPonyfill extends ImportMetaPonyfillCommonjs, ImportMetaPonyfillEsmodule {
|
|
96
|
+
}
|
|
97
|
+
export declare let import_meta_ponyfill_commonjs: ImportMetaPonyfillCommonjs;
|
|
98
|
+
export declare let import_meta_ponyfill_esmodule: ImportMetaPonyfillEsmodule;
|
|
99
|
+
export declare let import_meta_ponyfill: ImportMetaPonyfill;
|
|
100
|
+
export {};
|
|
101
|
+
//# sourceMappingURL=_dnt.polyfills.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_dnt.polyfills.d.ts","sourceRoot":"","sources":["../src/_dnt.polyfills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAgC,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AAGlE,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB;;;;;;;;;;;;;;WAcG;QACH,GAAG,EAAE,MAAM,CAAC;QACZ;;;;;;;;;;;;WAYG;QACH,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,GAAG,MAAM,CAAC;QACtE;;;;;;;;WAQG;QACH,IAAI,EAAE,OAAO,CAAC;QAEd;;;;;;;;;;;;WAYG;QACH,QAAQ,EAAE,MAAM,CAAC;QAEjB;;;;;;;;;;;;WAYG;QACH,OAAO,EAAE,MAAM,CAAC;KACjB;CACF;AAED,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,KAAK,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;AACnD,UAAU,0BAA0B;IAClC,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;CACxD;AACD,UAAU,0BAA0B;IAClC,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC;CACtC;AACD,UAAU,kBACR,SAAQ,0BAA0B,EAAE,0BAA0B;CAC/D;AAiBD,eAAO,IAAI,6BAA6B,EA2BnC,0BAA0B,CAAC;AAMhC,eAAO,IAAI,6BAA6B,EA4DnC,0BAA0B,CAAC;AAMhC,eAAO,IAAI,oBAAoB,EAoB1B,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
|
|
3
|
+
* but instead of using npm to install additional dependencies,
|
|
4
|
+
* this approach manually consolidates cjs/mjs/d.ts into a single file.
|
|
5
|
+
*
|
|
6
|
+
* Note that this code might be imported multiple times
|
|
7
|
+
* (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
|
|
8
|
+
* or Node.js might dynamically clear the cache and then force a require).
|
|
9
|
+
* Therefore, it's important to avoid redundant writes to global objects.
|
|
10
|
+
* Additionally, consider that commonjs is used alongside esm,
|
|
11
|
+
* so the two ponyfill functions are stored independently in two separate global objects.
|
|
12
|
+
*/
|
|
13
|
+
//@ts-ignore
|
|
14
|
+
import { createRequire } from "node:module";
|
|
15
|
+
//@ts-ignore
|
|
16
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
17
|
+
//@ts-ignore
|
|
18
|
+
import { dirname } from "node:path";
|
|
19
|
+
const defineGlobalPonyfill = (symbolFor, fn) => {
|
|
20
|
+
if (!Reflect.has(globalThis, Symbol.for(symbolFor))) {
|
|
21
|
+
Object.defineProperty(globalThis, Symbol.for(symbolFor), {
|
|
22
|
+
configurable: true,
|
|
23
|
+
get() {
|
|
24
|
+
return fn;
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export let import_meta_ponyfill_commonjs = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-commonjs")) ??
|
|
30
|
+
(() => {
|
|
31
|
+
const moduleImportMetaWM = new WeakMap();
|
|
32
|
+
return (require, module) => {
|
|
33
|
+
let importMetaCache = moduleImportMetaWM.get(module);
|
|
34
|
+
if (importMetaCache == null) {
|
|
35
|
+
const importMeta = Object.assign(Object.create(null), {
|
|
36
|
+
url: pathToFileURL(module.filename).href,
|
|
37
|
+
main: require.main == module,
|
|
38
|
+
resolve: (specifier, parentURL = importMeta.url) => {
|
|
39
|
+
return pathToFileURL((importMeta.url === parentURL
|
|
40
|
+
? require
|
|
41
|
+
: createRequire(parentURL))
|
|
42
|
+
.resolve(specifier)).href;
|
|
43
|
+
},
|
|
44
|
+
filename: module.filename,
|
|
45
|
+
dirname: module.path,
|
|
46
|
+
});
|
|
47
|
+
moduleImportMetaWM.set(module, importMeta);
|
|
48
|
+
importMetaCache = importMeta;
|
|
49
|
+
}
|
|
50
|
+
return importMetaCache;
|
|
51
|
+
};
|
|
52
|
+
})());
|
|
53
|
+
defineGlobalPonyfill("import-meta-ponyfill-commonjs", import_meta_ponyfill_commonjs);
|
|
54
|
+
export let import_meta_ponyfill_esmodule = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-esmodule")) ??
|
|
55
|
+
((importMeta) => {
|
|
56
|
+
const resolveFunStr = String(importMeta.resolve);
|
|
57
|
+
const shimWs = new WeakSet();
|
|
58
|
+
//@ts-ignore
|
|
59
|
+
const mainUrl = ("file:///" + process.argv[1].replace(/\\/g, "/"))
|
|
60
|
+
.replace(/\/{3,}/, "///");
|
|
61
|
+
const commonShim = (importMeta) => {
|
|
62
|
+
if (typeof importMeta.main !== "boolean") {
|
|
63
|
+
importMeta.main = importMeta.url === mainUrl;
|
|
64
|
+
}
|
|
65
|
+
if (typeof importMeta.filename !== "string") {
|
|
66
|
+
importMeta.filename = fileURLToPath(importMeta.url);
|
|
67
|
+
importMeta.dirname = dirname(importMeta.filename);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
if (
|
|
71
|
+
// v16.2.0+, v14.18.0+: Add support for WHATWG URL object to parentURL parameter.
|
|
72
|
+
resolveFunStr === "undefined" ||
|
|
73
|
+
// v20.0.0+, v18.19.0+"" This API now returns a string synchronously instead of a Promise.
|
|
74
|
+
resolveFunStr.startsWith("async")
|
|
75
|
+
// enable by --experimental-import-meta-resolve flag
|
|
76
|
+
) {
|
|
77
|
+
import_meta_ponyfill_esmodule = (importMeta) => {
|
|
78
|
+
if (!shimWs.has(importMeta)) {
|
|
79
|
+
shimWs.add(importMeta);
|
|
80
|
+
const importMetaUrlRequire = {
|
|
81
|
+
url: importMeta.url,
|
|
82
|
+
require: createRequire(importMeta.url),
|
|
83
|
+
};
|
|
84
|
+
importMeta.resolve = function resolve(specifier, parentURL = importMeta.url) {
|
|
85
|
+
return pathToFileURL((importMetaUrlRequire.url === parentURL
|
|
86
|
+
? importMetaUrlRequire.require
|
|
87
|
+
: createRequire(parentURL)).resolve(specifier)).href;
|
|
88
|
+
};
|
|
89
|
+
commonShim(importMeta);
|
|
90
|
+
}
|
|
91
|
+
return importMeta;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
/// native support
|
|
96
|
+
import_meta_ponyfill_esmodule = (importMeta) => {
|
|
97
|
+
if (!shimWs.has(importMeta)) {
|
|
98
|
+
shimWs.add(importMeta);
|
|
99
|
+
commonShim(importMeta);
|
|
100
|
+
}
|
|
101
|
+
return importMeta;
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return import_meta_ponyfill_esmodule(importMeta);
|
|
105
|
+
}));
|
|
106
|
+
defineGlobalPonyfill("import-meta-ponyfill-esmodule", import_meta_ponyfill_esmodule);
|
|
107
|
+
export let import_meta_ponyfill = ((...args) => {
|
|
108
|
+
const _MODULE = (() => {
|
|
109
|
+
if (typeof require === "function" && typeof module === "object") {
|
|
110
|
+
return "commonjs";
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
// eval("typeof import.meta");
|
|
114
|
+
return "esmodule";
|
|
115
|
+
}
|
|
116
|
+
})();
|
|
117
|
+
if (_MODULE === "commonjs") {
|
|
118
|
+
//@ts-ignore
|
|
119
|
+
import_meta_ponyfill = (r, m) => import_meta_ponyfill_commonjs(r, m);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
//@ts-ignore
|
|
123
|
+
import_meta_ponyfill = (im) => import_meta_ponyfill_esmodule(im);
|
|
124
|
+
}
|
|
125
|
+
//@ts-ignore
|
|
126
|
+
return import_meta_ponyfill(...args);
|
|
127
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_dnt.shims.d.ts","sourceRoot":"","sources":["../src/_dnt.shims.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAKvC,eAAO,MAAM,aAAa;;CAA2C,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Deno } from "@deno/shim-deno";
|
|
2
|
+
export { Deno } from "@deno/shim-deno";
|
|
3
|
+
const dntGlobals = {
|
|
4
|
+
Deno,
|
|
5
|
+
};
|
|
6
|
+
export const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
|
|
7
|
+
function createMergeProxy(baseObj, extObj) {
|
|
8
|
+
return new Proxy(baseObj, {
|
|
9
|
+
get(_target, prop, _receiver) {
|
|
10
|
+
if (prop in extObj) {
|
|
11
|
+
return extObj[prop];
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
return baseObj[prop];
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
set(_target, prop, value) {
|
|
18
|
+
if (prop in extObj) {
|
|
19
|
+
delete extObj[prop];
|
|
20
|
+
}
|
|
21
|
+
baseObj[prop] = value;
|
|
22
|
+
return true;
|
|
23
|
+
},
|
|
24
|
+
deleteProperty(_target, prop) {
|
|
25
|
+
let success = false;
|
|
26
|
+
if (prop in extObj) {
|
|
27
|
+
delete extObj[prop];
|
|
28
|
+
success = true;
|
|
29
|
+
}
|
|
30
|
+
if (prop in baseObj) {
|
|
31
|
+
delete baseObj[prop];
|
|
32
|
+
success = true;
|
|
33
|
+
}
|
|
34
|
+
return success;
|
|
35
|
+
},
|
|
36
|
+
ownKeys(_target) {
|
|
37
|
+
const baseKeys = Reflect.ownKeys(baseObj);
|
|
38
|
+
const extKeys = Reflect.ownKeys(extObj);
|
|
39
|
+
const extKeysSet = new Set(extKeys);
|
|
40
|
+
return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
|
|
41
|
+
},
|
|
42
|
+
defineProperty(_target, prop, desc) {
|
|
43
|
+
if (prop in extObj) {
|
|
44
|
+
delete extObj[prop];
|
|
45
|
+
}
|
|
46
|
+
Reflect.defineProperty(baseObj, prop, desc);
|
|
47
|
+
return true;
|
|
48
|
+
},
|
|
49
|
+
getOwnPropertyDescriptor(_target, prop) {
|
|
50
|
+
if (prop in extObj) {
|
|
51
|
+
return Reflect.getOwnPropertyDescriptor(extObj, prop);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
return Reflect.getOwnPropertyDescriptor(baseObj, prop);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
has(_target, prop) {
|
|
58
|
+
return prop in extObj || prop in baseObj;
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
}
|
package/esm/deno.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let nodeModulesDir: string;
|
|
3
|
+
let name: string;
|
|
4
|
+
let version: string;
|
|
5
|
+
let exports: string;
|
|
6
|
+
namespace publish {
|
|
7
|
+
let include: string[];
|
|
8
|
+
}
|
|
9
|
+
namespace tasks {
|
|
10
|
+
let start: string;
|
|
11
|
+
let test: string;
|
|
12
|
+
}
|
|
13
|
+
let imports: {
|
|
14
|
+
"@std/cli": string;
|
|
15
|
+
"@std/fs": string;
|
|
16
|
+
"@std/path": string;
|
|
17
|
+
"@std/streams": string;
|
|
18
|
+
"@std/assert": string;
|
|
19
|
+
"@std/async": string;
|
|
20
|
+
"@std/fmt": string;
|
|
21
|
+
"@cliffy/command": string;
|
|
22
|
+
"@cliffy/prompt": string;
|
|
23
|
+
dnt: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export default _default;
|
|
27
|
+
//# sourceMappingURL=deno.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deno.d.ts","sourceRoot":"","sources":["../src/deno.js"],"names":[],"mappings":""}
|
package/esm/deno.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"nodeModulesDir": "auto",
|
|
3
|
+
"name": "@seyuna/cli",
|
|
4
|
+
"version": "1.0.0-canary.21",
|
|
5
|
+
"exports": "./src/main.ts",
|
|
6
|
+
"publish": {
|
|
7
|
+
"include": [
|
|
8
|
+
"src/**/*.ts",
|
|
9
|
+
"deno.json",
|
|
10
|
+
"README.md",
|
|
11
|
+
"LICENSE"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"tasks": {
|
|
15
|
+
"start": "deno run -A src/main.ts",
|
|
16
|
+
"test": "deno test -A"
|
|
17
|
+
},
|
|
18
|
+
"imports": {
|
|
19
|
+
"@std/cli": "npm:@jsr/std__cli@^1.0.25",
|
|
20
|
+
"@std/fs": "npm:@jsr/std__fs@^1.0.0",
|
|
21
|
+
"@std/path": "npm:@jsr/std__path@^1.0.0",
|
|
22
|
+
"@std/streams": "npm:@jsr/std__streams@^1.0.8",
|
|
23
|
+
"@std/assert": "npm:@jsr/std__assert@^1.0.0",
|
|
24
|
+
"@std/async": "npm:@jsr/std__async@^1.0.0",
|
|
25
|
+
"@std/fmt": "npm:@jsr/std__fmt@^1.0.0",
|
|
26
|
+
"@cliffy/command": "npm:@jsr/cliffy__command@^1.0.0-rc.8",
|
|
27
|
+
"@cliffy/prompt": "npm:@jsr/cliffy__prompt@^1.0.0-rc.8",
|
|
28
|
+
"dnt": "jsr:@deno/dnt@0.42.3"
|
|
29
|
+
}
|
|
30
|
+
};
|
package/esm/package.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initializes a new Seyuna project by creating a 'seyuna.json' configuration file.
|
|
3
|
+
* This function performs safety checks to avoid overwriting existing configurations.
|
|
4
|
+
*
|
|
5
|
+
* @returns A promise that resolves when initialization is complete.
|
|
6
|
+
*/
|
|
7
|
+
export declare function initConfig(): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/src/config/init.ts"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAgEhD"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
2
|
+
import { UI_CONFIGURATION } from "../ui/default.js";
|
|
3
|
+
import { SeyunaSpinner } from "../helpers/cli.js";
|
|
4
|
+
import { Brand } from "../helpers/styles.js";
|
|
5
|
+
import { Input, Select } from "@jsr/cliffy__prompt";
|
|
6
|
+
/**
|
|
7
|
+
* Initializes a new Seyuna project by creating a 'seyuna.json' configuration file.
|
|
8
|
+
* This function performs safety checks to avoid overwriting existing configurations.
|
|
9
|
+
*
|
|
10
|
+
* @returns A promise that resolves when initialization is complete.
|
|
11
|
+
*/
|
|
12
|
+
export async function initConfig() {
|
|
13
|
+
const licenseKey = await Input.prompt({
|
|
14
|
+
message: `${Brand.muted("›")} Enter your Seyuna license key (optional)`,
|
|
15
|
+
});
|
|
16
|
+
const outputDir = await Input.prompt({
|
|
17
|
+
message: `${Brand.muted("›")} Output directory for generated CSS`,
|
|
18
|
+
default: "src/styles",
|
|
19
|
+
}) || "src/styles";
|
|
20
|
+
const mode = await Select.prompt({
|
|
21
|
+
message: `${Brand.muted("›")} Default color appearance mode`,
|
|
22
|
+
default: "system",
|
|
23
|
+
options: [
|
|
24
|
+
{ name: "System", value: "system" },
|
|
25
|
+
{ name: "Light", value: "light" },
|
|
26
|
+
{ name: "Dark", value: "dark" },
|
|
27
|
+
],
|
|
28
|
+
});
|
|
29
|
+
const spinner = new SeyunaSpinner("Setting up your Seyuna project").start();
|
|
30
|
+
try {
|
|
31
|
+
/** @type {Config} Template for the initial project configuration */
|
|
32
|
+
const config = {
|
|
33
|
+
license: licenseKey || undefined,
|
|
34
|
+
ui: {
|
|
35
|
+
...UI_CONFIGURATION,
|
|
36
|
+
mode,
|
|
37
|
+
output_dir: outputDir,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
spinner.progress("Building configuration manifest");
|
|
41
|
+
const json = JSON.stringify(config, null, 2);
|
|
42
|
+
spinner.progress("Writing manifest to disk");
|
|
43
|
+
const fileName = "seyuna.json";
|
|
44
|
+
// Safety check: Avoid accidental overwrites of existing configurations
|
|
45
|
+
try {
|
|
46
|
+
const stats = await dntShim.Deno.stat(fileName);
|
|
47
|
+
if (stats.isFile) {
|
|
48
|
+
spinner.error(`Existing '${fileName}' found. Initialization aborted to prevent data loss.`);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
if (!(error instanceof dntShim.Deno.errors.NotFound)) {
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
// File doesn't exist, proceed with initialization
|
|
57
|
+
}
|
|
58
|
+
await dntShim.Deno.writeTextFile(fileName, json);
|
|
59
|
+
spinner.done("Success! Your project is now powered by Seyuna.");
|
|
60
|
+
// Display helpful onboarding steps
|
|
61
|
+
console.log(`\n${Brand.muted("Next steps:")}`);
|
|
62
|
+
console.log(`${Brand.secondary("seyuna ui --compile")} ${Brand.muted("Build your initial styles")}`);
|
|
63
|
+
console.log(`${Brand.secondary("seyuna ui --watch")} ${Brand.muted("Start the development server")}`);
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
spinner.error(`Failed to initialize: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { UI } from "../ui/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Root configuration structure for a Seyuna project.
|
|
4
|
+
* This interface represents the schema of the 'seyuna.json' file.
|
|
5
|
+
*/
|
|
6
|
+
export interface Config {
|
|
7
|
+
/**
|
|
8
|
+
* Optional license key for premium features.
|
|
9
|
+
*/
|
|
10
|
+
license?: string;
|
|
11
|
+
/**
|
|
12
|
+
* UI and styling engine configuration.
|
|
13
|
+
*/
|
|
14
|
+
ui?: UI;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Deeply merges two project configurations.
|
|
18
|
+
* Currently handles nested merging for the 'ui' property.
|
|
19
|
+
*
|
|
20
|
+
* @param base - The default or base configuration
|
|
21
|
+
* @param override - The user-provided or overriding configuration
|
|
22
|
+
* @returns A new configuration object with combined properties
|
|
23
|
+
*/
|
|
24
|
+
export declare function mergeConfig(base: Config, override: Config): Config;
|
|
25
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/src/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAGzC;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,EAAE,CAAC,EAAE,EAAE,CAAC;CACT;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQlE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { mergeUI } from "../ui/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Deeply merges two project configurations.
|
|
4
|
+
* Currently handles nested merging for the 'ui' property.
|
|
5
|
+
*
|
|
6
|
+
* @param base - The default or base configuration
|
|
7
|
+
* @param override - The user-provided or overriding configuration
|
|
8
|
+
* @returns A new configuration object with combined properties
|
|
9
|
+
*/
|
|
10
|
+
export function mergeConfig(base, override) {
|
|
11
|
+
return {
|
|
12
|
+
...base,
|
|
13
|
+
...override,
|
|
14
|
+
ui: base.ui && override.ui
|
|
15
|
+
? mergeUI(base.ui, override.ui)
|
|
16
|
+
: (override.ui ?? base.ui),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A branded spinner class that provides visual feedback for long-running CLI operations.
|
|
3
|
+
* It uses the Seyuna color palette and gradients for a premium experience.
|
|
4
|
+
*/
|
|
5
|
+
export declare class SeyunaSpinner {
|
|
6
|
+
private spinner;
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new branded spinner.
|
|
9
|
+
* @param message - The initial message to display next to the spinner.
|
|
10
|
+
*/
|
|
11
|
+
constructor(message: string);
|
|
12
|
+
/**
|
|
13
|
+
* Starts the spinner animation.
|
|
14
|
+
* @returns The spinner instance for chaining.
|
|
15
|
+
*/
|
|
16
|
+
start(): this;
|
|
17
|
+
/**
|
|
18
|
+
* Updates the message displayed next to the active spinner.
|
|
19
|
+
* @param message - The new progress message.
|
|
20
|
+
*/
|
|
21
|
+
progress(message: string): void;
|
|
22
|
+
/**
|
|
23
|
+
* Stops the spinner and displays a branded success message.
|
|
24
|
+
* @param message - The message to display upon completion.
|
|
25
|
+
*/
|
|
26
|
+
done(message: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Stops the spinner and displays a branded error message.
|
|
29
|
+
* @param message - The error message to display.
|
|
30
|
+
*/
|
|
31
|
+
error(message: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* Stops the spinner and displays a branded warning message.
|
|
34
|
+
* @param message - The warning message to display.
|
|
35
|
+
*/
|
|
36
|
+
warning(message: string): void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Convenience function to create and start a branded spinner in one call.
|
|
40
|
+
*
|
|
41
|
+
* @param message - The message to display.
|
|
42
|
+
* @returns An active SeyunaSpinner instance.
|
|
43
|
+
*/
|
|
44
|
+
export declare function startSpinner(message: string): SeyunaSpinner;
|
|
45
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/src/helpers/cli.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAU;IAEzB;;;OAGG;gBACS,OAAO,EAAE,MAAM;IAO3B;;;OAGG;IACH,KAAK,IAAI,IAAI;IAKb;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI/B;;;OAGG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAK3B;;;OAGG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAK5B;;;OAGG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAI/B;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAE3D"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Spinner } from "@jsr/std__cli/unstable-spinner";
|
|
2
|
+
import { Brand, seyunaGradient, Symbols } from "./styles.js";
|
|
3
|
+
/**
|
|
4
|
+
* A branded spinner class that provides visual feedback for long-running CLI operations.
|
|
5
|
+
* It uses the Seyuna color palette and gradients for a premium experience.
|
|
6
|
+
*/
|
|
7
|
+
export class SeyunaSpinner {
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new branded spinner.
|
|
10
|
+
* @param message - The initial message to display next to the spinner.
|
|
11
|
+
*/
|
|
12
|
+
constructor(message) {
|
|
13
|
+
Object.defineProperty(this, "spinner", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
configurable: true,
|
|
16
|
+
writable: true,
|
|
17
|
+
value: void 0
|
|
18
|
+
});
|
|
19
|
+
this.spinner = new Spinner({
|
|
20
|
+
message: seyunaGradient(message),
|
|
21
|
+
color: "cyan",
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Starts the spinner animation.
|
|
26
|
+
* @returns The spinner instance for chaining.
|
|
27
|
+
*/
|
|
28
|
+
start() {
|
|
29
|
+
this.spinner.start();
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Updates the message displayed next to the active spinner.
|
|
34
|
+
* @param message - The new progress message.
|
|
35
|
+
*/
|
|
36
|
+
progress(message) {
|
|
37
|
+
this.spinner.message = seyunaGradient(message);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Stops the spinner and displays a branded success message.
|
|
41
|
+
* @param message - The message to display upon completion.
|
|
42
|
+
*/
|
|
43
|
+
done(message) {
|
|
44
|
+
this.spinner.stop();
|
|
45
|
+
console.log(`${Symbols.success} ${Brand.success(message)}`);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Stops the spinner and displays a branded error message.
|
|
49
|
+
* @param message - The error message to display.
|
|
50
|
+
*/
|
|
51
|
+
error(message) {
|
|
52
|
+
this.spinner.stop();
|
|
53
|
+
console.log(`${Symbols.error} ${Brand.error(message)}`);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Stops the spinner and displays a branded warning message.
|
|
57
|
+
* @param message - The warning message to display.
|
|
58
|
+
*/
|
|
59
|
+
warning(message) {
|
|
60
|
+
this.spinner.stop();
|
|
61
|
+
console.log(`${Symbols.warning} ${Brand.warning(message)}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Convenience function to create and start a branded spinner in one call.
|
|
66
|
+
*
|
|
67
|
+
* @param message - The message to display.
|
|
68
|
+
* @returns An active SeyunaSpinner instance.
|
|
69
|
+
*/
|
|
70
|
+
export function startSpinner(message) {
|
|
71
|
+
return new SeyunaSpinner(message).start();
|
|
72
|
+
}
|