@shell-shock/core 0.0.2 → 0.1.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.
@@ -0,0 +1 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
package/dist/api.cjs CHANGED
@@ -1 +1 @@
1
- const e=require(`./powerlines.cjs`);let t=require(`defu`),n=require(`powerlines`);var r=class r{#e;static async from(i={}){return new r(await(0,n.createPowerlines)((0,t.defu)(i,{plugins:[e.shellShock()]})))}constructor(e){this.#e=e}async clean(e){return this.#e.clean(e)}async prepare(e){return this.#e.prepare(e)}async lint(e){return this.#e.lint(e)}async build(e){return this.#e.build(e)}async docs(e){return this.#e.docs(e)}async finalize(){return this.#e.finalize()}};exports.ShellShockAPI=r;
1
+ const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./powerlines.cjs`);let n=require(`powerlines`);var r=class e{#e;static async from(r={}){return new e(await(0,n.createPowerlines)({...r,plugins:(r.plugins??[]).concat(t.shellShock())}))}constructor(e){this.#e=e}async clean(e){return this.#e.clean(e)}async prepare(e){return this.#e.prepare(e)}async lint(e){return this.#e.lint(e)}async build(e){return this.#e.build(e)}async docs(e){return this.#e.docs(e)}async finalize(){return this.#e.finalize()}};exports.ShellShockAPI=r;
package/dist/api.d.cts CHANGED
@@ -1,10 +1,10 @@
1
- import { UserConfig as UserConfig$1 } from "./types/config.cjs";
1
+ import { UserConfig } from "./types/config.cjs";
2
2
  import { BuildInlineConfig, CleanInlineConfig, DocsInlineConfig, LintInlineConfig, PrepareInlineConfig } from "powerlines/types/config";
3
3
 
4
4
  //#region src/api.d.ts
5
5
  declare class ShellShockAPI {
6
6
  #private;
7
- static from(config?: UserConfig$1): Promise<ShellShockAPI>;
7
+ static from(config?: UserConfig): Promise<ShellShockAPI>;
8
8
  private constructor();
9
9
  clean(inlineConfig: CleanInlineConfig): Promise<void>;
10
10
  prepare(inlineConfig: PrepareInlineConfig): Promise<void>;
package/dist/api.d.mts CHANGED
@@ -1,10 +1,10 @@
1
- import { UserConfig as UserConfig$1 } from "./types/config.mjs";
1
+ import { UserConfig } from "./types/config.mjs";
2
2
  import { BuildInlineConfig, CleanInlineConfig, DocsInlineConfig, LintInlineConfig, PrepareInlineConfig } from "powerlines/types/config";
3
3
 
4
4
  //#region src/api.d.ts
5
5
  declare class ShellShockAPI {
6
6
  #private;
7
- static from(config?: UserConfig$1): Promise<ShellShockAPI>;
7
+ static from(config?: UserConfig): Promise<ShellShockAPI>;
8
8
  private constructor();
9
9
  clean(inlineConfig: CleanInlineConfig): Promise<void>;
10
10
  prepare(inlineConfig: PrepareInlineConfig): Promise<void>;
package/dist/api.mjs CHANGED
@@ -1 +1 @@
1
- import{shellShock as e}from"./powerlines.mjs";import{defu as t}from"defu";import{createPowerlines as n}from"powerlines";var r=class r{#e;static async from(i={}){return new r(await n(t(i,{plugins:[e()]})))}constructor(e){this.#e=e}async clean(e){return this.#e.clean(e)}async prepare(e){return this.#e.prepare(e)}async lint(e){return this.#e.lint(e)}async build(e){return this.#e.build(e)}async docs(e){return this.#e.docs(e)}async finalize(){return this.#e.finalize()}};export{r as ShellShockAPI};
1
+ import{shellShock as e}from"./powerlines.mjs";import{createPowerlines as t}from"powerlines";var n=class n{#e;static async from(r={}){return new n(await t({...r,plugins:(r.plugins??[]).concat(e())}))}constructor(e){this.#e=e}async clean(e){return this.#e.clean(e)}async prepare(e){return this.#e.prepare(e)}async lint(e){return this.#e.lint(e)}async build(e){return this.#e.build(e)}async docs(e){return this.#e.docs(e)}async finalize(){return this.#e.finalize()}};export{n as ShellShockAPI};
@@ -0,0 +1 @@
1
+ const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/append`),n=require(`@stryke/path/file-path-fns`),r=require(`@stryke/type-checks/is-set-object`),i=require(`@stryke/path/common`),a=require(`@stryke/path/normalize`),o=require(`@stryke/path/replace`),s=require(`@stryke/type-checks/is-set-string`);function c(e,t){return(0,o.replacePath)((0,n.findFilePath)(t),e.commandsRoot).replaceAll(/^\/+/g,``).replaceAll(/\/+$/g,``)}function l(e){return(0,s.isSetString)(e.config.entry)?(0,t.appendPath)((0,t.appendPath)((0,a.stripStars)(e.config.entry),e.config.projectRoot),e.workspaceConfig.workspaceRoot):(0,r.isSetObject)(e.config.entry)&&`file`in e.config.entry?(0,t.appendPath)((0,t.appendPath)((0,a.stripStars)(e.config.entry.file),e.config.projectRoot),e.workspaceConfig.workspaceRoot):Array.isArray(e.config.entry)&&e.config.entry.length>0?(0,i.commonPath)(e.config.entry.map(n=>(0,t.appendPath)((0,t.appendPath)((0,a.stripStars)((0,s.isSetString)(n)?n:n.file),e.config.projectRoot),e.workspaceConfig.workspaceRoot))):(0,t.appendPath)(e.config.sourceRoot||e.config.projectRoot,e.workspaceConfig.workspaceRoot)}exports.findCommandsRoot=l,exports.resolveCommandPath=c;
@@ -0,0 +1 @@
1
+ import{appendPath as e}from"@stryke/path/append";import{findFilePath as t}from"@stryke/path/file-path-fns";import{isSetObject as n}from"@stryke/type-checks/is-set-object";import{commonPath as r}from"@stryke/path/common";import{stripStars as i}from"@stryke/path/normalize";import{replacePath as a}from"@stryke/path/replace";import{isSetString as o}from"@stryke/type-checks/is-set-string";function s(e,n){return a(t(n),e.commandsRoot).replaceAll(/^\/+/g,``).replaceAll(/\/+$/g,``)}function c(t){return o(t.config.entry)?e(e(i(t.config.entry),t.config.projectRoot),t.workspaceConfig.workspaceRoot):n(t.config.entry)&&`file`in t.config.entry?e(e(i(t.config.entry.file),t.config.projectRoot),t.workspaceConfig.workspaceRoot):Array.isArray(t.config.entry)&&t.config.entry.length>0?r(t.config.entry.map(n=>e(e(i(o(n)?n:n.file),t.config.projectRoot),t.workspaceConfig.workspaceRoot))):e(t.config.sourceRoot||t.config.projectRoot,t.workspaceConfig.workspaceRoot)}export{c as findCommandsRoot,s as resolveCommandPath};
@@ -0,0 +1 @@
1
+ const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/join-paths`),n=require(`@stryke/type-checks/is-set-object`),r=require(`@stryke/path/replace`),i=require(`@stryke/convert/to-array`),a=require(`@stryke/helpers/get-unique`),o=require(`@stryke/json/storm-json`),s=require(`@stryke/string-format/kebab-case`);function c(e,t){return`./bin/${(0,s.kebabCase)((0,r.replaceExtension)(e))}.${t===`cjs`||Array.isArray(t)&&t.includes(`cjs`)?`cjs`:`mjs`}`}async function l(e){let r=(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`package.json`);if(e.config.bin&&Array.isArray(e.config.bin)&&e.config.bin.length>0?(e.packageJson.bin=Object.fromEntries((0,a.getUnique)((0,i.toArray)(e.config.bin)).map(t=>[t,c(t,e.config.output.format)])),await e.fs.write(r,o.StormJSON.stringify(e.packageJson))):!(0,n.isSetObject)(e.packageJson.bin)&&(e.config.name||e.packageJson.name)&&(e.packageJson.bin={[e.config.name||e.packageJson.name]:c(e.config.name||e.packageJson.name,e.config.output.format)},await e.fs.write(r,o.StormJSON.stringify(e.packageJson))),!(0,n.isSetObject)(e.packageJson.bin))throw Error("Unable to determine the CLI binary name. Please specify the `bin` option in your Shell Shock configuration or ensure that the `name` field is set in your package.json.");e.config.bin=Object.keys(e.packageJson.bin)}exports.updatePackageJsonBinary=l;
@@ -0,0 +1 @@
1
+ import{joinPaths as e}from"@stryke/path/join-paths";import{isSetObject as t}from"@stryke/type-checks/is-set-object";import{replaceExtension as n}from"@stryke/path/replace";import{toArray as r}from"@stryke/convert/to-array";import{getUnique as i}from"@stryke/helpers/get-unique";import{StormJSON as a}from"@stryke/json/storm-json";import{kebabCase as o}from"@stryke/string-format/kebab-case";function s(e,t){return`./bin/${o(n(e))}.${t===`cjs`||Array.isArray(t)&&t.includes(`cjs`)?`cjs`:`mjs`}`}async function c(n){let o=e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`package.json`);if(n.config.bin&&Array.isArray(n.config.bin)&&n.config.bin.length>0?(n.packageJson.bin=Object.fromEntries(i(r(n.config.bin)).map(e=>[e,s(e,n.config.output.format)])),await n.fs.write(o,a.stringify(n.packageJson))):!t(n.packageJson.bin)&&(n.config.name||n.packageJson.name)&&(n.packageJson.bin={[n.config.name||n.packageJson.name]:s(n.config.name||n.packageJson.name,n.config.output.format)},await n.fs.write(o,a.stringify(n.packageJson))),!t(n.packageJson.bin))throw Error("Unable to determine the CLI binary name. Please specify the `bin` option in your Shell Shock configuration or ensure that the `name` field is set in your package.json.");n.config.bin=Object.keys(n.packageJson.bin)}export{c as updatePackageJsonBinary};
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Options, ResolvedConfig, UserConfig } from "./types/config.cjs";
2
2
  import { ShellShockAPI } from "./api.cjs";
3
3
  import { defineConfig } from "./config.cjs";
4
- import { BuildContext, CommandArg, CommandRelations, CommandTree } from "./types/build.cjs";
4
+ import { BuildContext, CommandArg, CommandEntry, CommandRelations, CommandTree } from "./types/build.cjs";
5
5
  import shellShock from "./powerlines.cjs";
6
- export { BuildContext, CommandArg, CommandRelations, CommandTree, Options, ResolvedConfig, ShellShockAPI, UserConfig, defineConfig, shellShock };
6
+ export { BuildContext, CommandArg, CommandEntry, CommandRelations, CommandTree, Options, ResolvedConfig, ShellShockAPI, UserConfig, defineConfig, shellShock };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Options, ResolvedConfig, UserConfig } from "./types/config.mjs";
2
2
  import { ShellShockAPI } from "./api.mjs";
3
3
  import { defineConfig } from "./config.mjs";
4
- import { BuildContext, CommandArg, CommandRelations, CommandTree } from "./types/build.mjs";
4
+ import { BuildContext, CommandArg, CommandEntry, CommandRelations, CommandTree } from "./types/build.mjs";
5
5
  import shellShock from "./powerlines.mjs";
6
- export { BuildContext, CommandArg, CommandRelations, CommandTree, Options, ResolvedConfig, ShellShockAPI, UserConfig, defineConfig, shellShock };
6
+ import "./types/index.mjs";
7
+ export { BuildContext, CommandArg, CommandEntry, CommandRelations, CommandTree, Options, ResolvedConfig, ShellShockAPI, UserConfig, defineConfig, shellShock };
@@ -1 +1,2 @@
1
- Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./lib/resolve-config.cjs`);let t=require(`defu`),n=require(`@stryke/convert/to-array`),r=require(`@stryke/string-format/kebab-case`);const i=(i={})=>({name:`shell-shock`,dependsOn:[],async config(){return this.trace("Providing default configuration for the Powerlines `vite` build plugin."),e.resolveConfig((0,t.defu)(i,this.config))},configResolved(){this.trace(`Shell Shock configuration has been resolved.`),this.config.bin=!this.config.bin||Array.isArray(this.config.bin)&&this.config.bin.length===0?this.packageJson.bin?Object.keys(this.packageJson.bin):[(0,r.kebabCase)(this.config.name)]:(0,n.toArray)(this.config.bin)}});var a=i;exports.default=a,exports.shellShock=i;
1
+ Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./helpers/resolve-command.cjs`),n=require(`./helpers/update-package-json.cjs`);let r=require(`@powerlines/plugin-tsdown`);r=e.__toESM(r);let i=require(`@stryke/fs/chmod-x`),a=require(`@stryke/path/append`),o=require(`@stryke/path/file-path-fns`),s=require(`@stryke/path/is-parent-path`),c=require(`@stryke/path/join-paths`),l=require(`@stryke/path/resolve-parent-path`),u=require(`@stryke/string-format/title-case`),d=require(`@stryke/type-checks/is-set-object`),f=require(`defu`),p=require(`node:fs`);const m=50,h=(e={})=>({name:`shell-shock`,dependsOn:[(0,r.default)()],async config(){return this.trace(`Resolving the Shell Shock configuration.`),(0,f.defu)(e,{entry:!this.config.entry||Array.isArray(this.config.entry)&&this.config.entry.length===0?[(0,c.joinPaths)(this.config.sourceRoot,`**/*`)]:void 0,build:{variant:`tsdown`},interactive:!0,skipDefaultArgs:!1,type:`application`,framework:`shell-shock`,singleBuild:!0})},async configResolved(){this.trace(`Shell Shock configuration has been resolved.`),await n.updatePackageJsonBinary(this),this.commandsRoot=t.findCommandsRoot(this),this.commands??=[],this.commands=this.entry.filter(e=>(0,o.findFileName)(e.file,{withExtension:!1})===`command`).reduce((e,n)=>{let r=(0,a.appendPath)((0,a.appendPath)(n.file,this.config.projectRoot),this.workspaceConfig.workspaceRoot);if(!(0,s.isParentPath)(r,this.commandsRoot))throw Error(`Command entry point "${r}" is not located within the commands root "${this.commandsRoot}". Please ensure that all command entry points are located within the current project.`);let i=t.resolveCommandPath(this,r),o=i.replaceAll(`/`,`-`);return e.some(e=>e.name===o)||e.push({path:i.split(`/`).filter(Boolean),name:o,title:(0,u.titleCase)(o),isVirtual:!1,entry:{...n,file:r,input:n,output:o}}),e},this.commands)},async prepare(){if(this.trace(`Finding and adding virtual commands to the entry points.`),this.commands=this.commands.reduce((e,n)=>{let r=0,i=(0,l.resolveParentPath)((0,o.findFilePath)(n.entry.file));for(;i!==this.commandsRoot;){if(r++>50)throw Error(`Maximum command virtual parent depth of 50 exceeded while processing command: ${n.name}`);let a=(0,o.findFolderName)(i);if(!e.some(e=>(0,o.findFilePath)(e.entry.file)===i)&&(!a.startsWith(`[`)||!a.endsWith(`]`))){let n=t.resolveCommandPath(this,i),r=n.replaceAll(`/`,`-`);e.push({path:n.split(`/`).filter(Boolean),name:r,title:(0,u.titleCase)(r),isVirtual:!0,entry:{file:(0,c.joinPaths)(i,`command.ts`),input:{file:(0,c.joinPaths)(i,`command.ts`)},output:a}})}i=(0,l.resolveParentPath)(i)}return e},this.commands).sort((e,t)=>e.name.localeCompare(t.name)),this.commands.length===0){this.warn(`No commands were found in the project. Please ensure at least one command exists.`);return}this.info(`Creating an application with the following commands: \n${this.commands.map(e=>` - ${e.title} (${e.name}): ${e.entry.file}${e.isVirtual?` (virtual)`:``}`).join(`
2
+ `)}`),this.entry=[]},async buildEnd(){if(!(0,d.isSetObject)(this.packageJson.bin)){this.warn(`No binaries were found in package.json. Please ensure the binaries are correctly configured.`);return}this.debug(`Adding executable permissions to binaries.`);for(let e of Object.values(this.packageJson.bin))(0,p.existsSync)((0,a.appendPath)(e,this.config.output.buildPath))&&await(0,i.chmodX)((0,a.appendPath)(e,this.config.output.buildPath))}});var g=h;exports.default=g,exports.shellShock=h;
@@ -1 +1,2 @@
1
- import{resolveConfig as e}from"./lib/resolve-config.mjs";import{defu as t}from"defu";import{toArray as n}from"@stryke/convert/to-array";import{kebabCase as r}from"@stryke/string-format/kebab-case";const i=(i={})=>({name:`shell-shock`,dependsOn:[],async config(){return this.trace("Providing default configuration for the Powerlines `vite` build plugin."),e(t(i,this.config))},configResolved(){this.trace(`Shell Shock configuration has been resolved.`),this.config.bin=!this.config.bin||Array.isArray(this.config.bin)&&this.config.bin.length===0?this.packageJson.bin?Object.keys(this.packageJson.bin):[r(this.config.name)]:n(this.config.bin)}});var a=i;export{a as default,i as shellShock};
1
+ import{findCommandsRoot as e,resolveCommandPath as t}from"./helpers/resolve-command.mjs";import{updatePackageJsonBinary as n}from"./helpers/update-package-json.mjs";import r from"@powerlines/plugin-tsdown";import{chmodX as i}from"@stryke/fs/chmod-x";import{appendPath as a}from"@stryke/path/append";import{findFileName as o,findFilePath as s,findFolderName as c}from"@stryke/path/file-path-fns";import{isParentPath as l}from"@stryke/path/is-parent-path";import{joinPaths as u}from"@stryke/path/join-paths";import{resolveParentPath as d}from"@stryke/path/resolve-parent-path";import{titleCase as f}from"@stryke/string-format/title-case";import{isSetObject as p}from"@stryke/type-checks/is-set-object";import{defu as m}from"defu";import{existsSync as h}from"node:fs";const g=(g={})=>({name:`shell-shock`,dependsOn:[r()],async config(){return this.trace(`Resolving the Shell Shock configuration.`),m(g,{entry:!this.config.entry||Array.isArray(this.config.entry)&&this.config.entry.length===0?[u(this.config.sourceRoot,`**/*`)]:void 0,build:{variant:`tsdown`},interactive:!0,skipDefaultArgs:!1,type:`application`,framework:`shell-shock`,singleBuild:!0})},async configResolved(){this.trace(`Shell Shock configuration has been resolved.`),await n(this),this.commandsRoot=e(this),this.commands??=[],this.commands=this.entry.filter(e=>o(e.file,{withExtension:!1})===`command`).reduce((e,n)=>{let r=a(a(n.file,this.config.projectRoot),this.workspaceConfig.workspaceRoot);if(!l(r,this.commandsRoot))throw Error(`Command entry point "${r}" is not located within the commands root "${this.commandsRoot}". Please ensure that all command entry points are located within the current project.`);let i=t(this,r),o=i.replaceAll(`/`,`-`);return e.some(e=>e.name===o)||e.push({path:i.split(`/`).filter(Boolean),name:o,title:f(o),isVirtual:!1,entry:{...n,file:r,input:n,output:o}}),e},this.commands)},async prepare(){if(this.trace(`Finding and adding virtual commands to the entry points.`),this.commands=this.commands.reduce((e,n)=>{let r=0,i=d(s(n.entry.file));for(;i!==this.commandsRoot;){if(r++>50)throw Error(`Maximum command virtual parent depth of 50 exceeded while processing command: ${n.name}`);let a=c(i);if(!e.some(e=>s(e.entry.file)===i)&&(!a.startsWith(`[`)||!a.endsWith(`]`))){let n=t(this,i),r=n.replaceAll(`/`,`-`);e.push({path:n.split(`/`).filter(Boolean),name:r,title:f(r),isVirtual:!0,entry:{file:u(i,`command.ts`),input:{file:u(i,`command.ts`)},output:a}})}i=d(i)}return e},this.commands).sort((e,t)=>e.name.localeCompare(t.name)),this.commands.length===0){this.warn(`No commands were found in the project. Please ensure at least one command exists.`);return}this.info(`Creating an application with the following commands: \n${this.commands.map(e=>` - ${e.title} (${e.name}): ${e.entry.file}${e.isVirtual?` (virtual)`:``}`).join(`
2
+ `)}`),this.entry=[]},async buildEnd(){if(!p(this.packageJson.bin)){this.warn(`No binaries were found in package.json. Please ensure the binaries are correctly configured.`);return}this.debug(`Adding executable permissions to binaries.`);for(let e of Object.values(this.packageJson.bin))h(a(e,this.config.output.buildPath))&&await i(a(e,this.config.output.buildPath))}});var _=g;export{_ as default,g as shellShock};
@@ -1,6 +1,6 @@
1
- import { ResolvedConfig as ResolvedConfig$1 } from "./config.cjs";
1
+ import { ResolvedConfig } from "./config.cjs";
2
+ import { TsdownPluginContext } from "@powerlines/plugin-tsdown";
2
3
  import { ResolvedEntryTypeDefinition } from "powerlines/types/resolved";
3
- import { PluginContext } from "powerlines/types/context";
4
4
 
5
5
  //#region src/types/build.d.ts
6
6
  type CommandArg = {
@@ -31,24 +31,36 @@ type CommandArg = {
31
31
  default?: boolean;
32
32
  isNegativeOf?: string;
33
33
  });
34
- interface CommandTree {
34
+ interface CommandEntry {
35
35
  path: string[];
36
36
  name: string;
37
37
  title: string;
38
38
  description?: string;
39
+ isVirtual: boolean;
40
+ entry: ResolvedEntryTypeDefinition;
41
+ }
42
+ type CommandTree = CommandEntry & {
39
43
  args: CommandArg[];
40
44
  parent: null | CommandTree;
41
45
  children: Record<string, CommandTree>;
42
- entry?: ResolvedEntryTypeDefinition;
43
- }
46
+ };
44
47
  interface CommandRelations {
45
48
  parent: string | null;
46
49
  children: string[];
47
50
  }
48
- type BuildContext<TResolvedConfig extends ResolvedConfig$1 = ResolvedConfig$1> = PluginContext<TResolvedConfig> & {
49
- shellShock: {
50
- commands: CommandTree;
51
- };
51
+ type BuildContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = TsdownPluginContext<TResolvedConfig> & {
52
+ /**
53
+ * The root path where commands are located.
54
+ */
55
+ commandsRoot: string;
56
+ /**
57
+ * The list of commands discovered in the project.
58
+ */
59
+ commands: CommandEntry[];
60
+ /**
61
+ * The command hierarchy tree.
62
+ */
63
+ tree: CommandTree;
52
64
  };
53
65
  //#endregion
54
- export { BuildContext, CommandArg, CommandRelations, CommandTree };
66
+ export { BuildContext, CommandArg, CommandEntry, CommandRelations, CommandTree };
@@ -1,6 +1,6 @@
1
- import { ResolvedConfig as ResolvedConfig$1 } from "./config.mjs";
1
+ import { ResolvedConfig } from "./config.mjs";
2
+ import { TsdownPluginContext } from "@powerlines/plugin-tsdown";
2
3
  import { ResolvedEntryTypeDefinition } from "powerlines/types/resolved";
3
- import { PluginContext } from "powerlines/types/context";
4
4
 
5
5
  //#region src/types/build.d.ts
6
6
  type CommandArg = {
@@ -31,24 +31,36 @@ type CommandArg = {
31
31
  default?: boolean;
32
32
  isNegativeOf?: string;
33
33
  });
34
- interface CommandTree {
34
+ interface CommandEntry {
35
35
  path: string[];
36
36
  name: string;
37
37
  title: string;
38
38
  description?: string;
39
+ isVirtual: boolean;
40
+ entry: ResolvedEntryTypeDefinition;
41
+ }
42
+ type CommandTree = CommandEntry & {
39
43
  args: CommandArg[];
40
44
  parent: null | CommandTree;
41
45
  children: Record<string, CommandTree>;
42
- entry?: ResolvedEntryTypeDefinition;
43
- }
46
+ };
44
47
  interface CommandRelations {
45
48
  parent: string | null;
46
49
  children: string[];
47
50
  }
48
- type BuildContext<TResolvedConfig extends ResolvedConfig$1 = ResolvedConfig$1> = PluginContext<TResolvedConfig> & {
49
- shellShock: {
50
- commands: CommandTree;
51
- };
51
+ type BuildContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = TsdownPluginContext<TResolvedConfig> & {
52
+ /**
53
+ * The root path where commands are located.
54
+ */
55
+ commandsRoot: string;
56
+ /**
57
+ * The list of commands discovered in the project.
58
+ */
59
+ commands: CommandEntry[];
60
+ /**
61
+ * The command hierarchy tree.
62
+ */
63
+ tree: CommandTree;
52
64
  };
53
65
  //#endregion
54
- export { BuildContext, CommandArg, CommandRelations, CommandTree };
66
+ export { BuildContext, CommandArg, CommandEntry, CommandRelations, CommandTree };
@@ -1,5 +1,4 @@
1
- import { UserConfig as UserConfig$1 } from "powerlines/types/config";
2
- import { ResolvedConfig as ResolvedConfig$1 } from "powerlines/types/resolved";
1
+ import { TsdownPluginResolvedConfig, TsdownPluginUserConfig } from "@powerlines/plugin-tsdown";
3
2
 
4
3
  //#region src/types/config.d.ts
5
4
  interface Options {
@@ -35,8 +34,8 @@ interface Options {
35
34
  */
36
35
  bin?: string | string[];
37
36
  }
38
- type UserConfig = Partial<Omit<UserConfig$1, "type" | "framework" | "singleBuild" | "environments">> & Options;
39
- type ResolvedConfig = ResolvedConfig$1 & Required<Omit<Options, "bin"> & {
37
+ type UserConfig = Partial<Omit<TsdownPluginUserConfig, "type" | "framework" | "singleBuild" | "environments">> & Options;
38
+ type ResolvedConfig = TsdownPluginResolvedConfig & Required<Omit<Options, "bin"> & {
40
39
  bin: string[];
41
40
  }>;
42
41
  //#endregion
@@ -1,5 +1,4 @@
1
- import { UserConfig as UserConfig$1 } from "powerlines/types/config";
2
- import { ResolvedConfig as ResolvedConfig$1 } from "powerlines/types/resolved";
1
+ import { TsdownPluginResolvedConfig, TsdownPluginUserConfig } from "@powerlines/plugin-tsdown";
3
2
 
4
3
  //#region src/types/config.d.ts
5
4
  interface Options {
@@ -35,8 +34,8 @@ interface Options {
35
34
  */
36
35
  bin?: string | string[];
37
36
  }
38
- type UserConfig = Partial<Omit<UserConfig$1, "type" | "framework" | "singleBuild" | "environments">> & Options;
39
- type ResolvedConfig = ResolvedConfig$1 & Required<Omit<Options, "bin"> & {
37
+ type UserConfig = Partial<Omit<TsdownPluginUserConfig, "type" | "framework" | "singleBuild" | "environments">> & Options;
38
+ type ResolvedConfig = TsdownPluginResolvedConfig & Required<Omit<Options, "bin"> & {
40
39
  bin: string[];
41
40
  }>;
42
41
  //#endregion
@@ -1,3 +1,3 @@
1
1
  import { Options, ResolvedConfig, UserConfig } from "./config.cjs";
2
- import { BuildContext, CommandArg, CommandRelations, CommandTree } from "./build.cjs";
3
- export { BuildContext, CommandArg, CommandRelations, CommandTree, Options, ResolvedConfig, UserConfig };
2
+ import { BuildContext, CommandArg, CommandEntry, CommandRelations, CommandTree } from "./build.cjs";
3
+ export { BuildContext, CommandArg, CommandEntry, CommandRelations, CommandTree, Options, ResolvedConfig, UserConfig };
@@ -1,3 +1,3 @@
1
1
  import { Options, ResolvedConfig, UserConfig } from "./config.mjs";
2
- import { BuildContext, CommandArg, CommandRelations, CommandTree } from "./build.mjs";
3
- export { BuildContext, CommandArg, CommandRelations, CommandTree, Options, ResolvedConfig, UserConfig };
2
+ import { BuildContext, CommandArg, CommandEntry, CommandRelations, CommandTree } from "./build.mjs";
3
+ export { BuildContext, CommandArg, CommandEntry, CommandRelations, CommandTree, Options, ResolvedConfig, UserConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shell-shock/core",
3
- "version": "0.0.2",
3
+ "version": "0.1.0",
4
4
  "type": "module",
5
5
  "description": "A package containing a Shell Shock plugin to generate source code given a list design tokens.",
6
6
  "repository": {
@@ -136,13 +136,18 @@
136
136
  "files": ["dist/**/*"],
137
137
  "keywords": ["shell-shock", "powerlines", "storm-software"],
138
138
  "dependencies": {
139
- "@powerlines/plugin-plugin": "^0.12.30",
139
+ "@powerlines/plugin-plugin": "^0.12.36",
140
+ "@powerlines/plugin-tsdown": "^0.1.36",
141
+ "@stryke/convert": "^0.6.29",
142
+ "@stryke/helpers": "^0.9.31",
143
+ "@stryke/json": "^0.9.32",
144
+ "@stryke/path": "^0.24.0",
145
+ "@stryke/string-format": "^0.12.29",
146
+ "@stryke/type-checks": "^0.5.14",
140
147
  "defu": "^6.1.4",
141
- "powerlines": "^0.32.8",
142
- "@stryke/convert": "^0.6.28",
143
- "@stryke/string-format": "^0.12.28"
148
+ "powerlines": "^0.34.2"
144
149
  },
145
150
  "devDependencies": { "@types/node": "^24.10.4", "typescript": "^5.9.3" },
146
151
  "publishConfig": { "access": "public" },
147
- "gitHead": "fc4e212121c6994387e4ff45bf6c2f3d2d371374"
152
+ "gitHead": "b81e1096d70d05cb3c5947f8ac5a926964a7af27"
148
153
  }
@@ -1 +0,0 @@
1
- let e=require(`defu`);async function t(t){return(0,e.defu)({build:{variant:`tsdown`},interactive:!0,skipDefaultArgs:!1,...t,type:`application`,framework:`shell-shock`,singleBuild:!0,environments:{}})}exports.resolveConfig=t;
@@ -1 +0,0 @@
1
- import{defu as e}from"defu";async function t(t){return e({build:{variant:`tsdown`},interactive:!0,skipDefaultArgs:!1,...t,type:`application`,framework:`shell-shock`,singleBuild:!0,environments:{}})}export{t as resolveConfig};