@dxtmisha/scripts 1.1.2 → 1.1.3

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/CHANGELOG.md CHANGED
@@ -8,9 +8,11 @@ All notable changes to this project will be documented in this file.
8
8
  - **Web-Types Generator AST Parsing (`DesignWikiStormItem`)**:
9
9
  - Replaced runtime dynamic Node.js ESM imports (`await import(...)`) of `wikiData.ts` with static TypeScript AST parsing via the TypeScript Compiler API (`ts.createSourceFile`).
10
10
  - Fixed `ERR_MODULE_NOT_FOUND` resolution errors occurring when `@dxtmisha/scripts` is installed and executed as an external package in consumer repositories containing extensionless TypeScript imports (`'../../../wiki/wiki'`, `'./props'`).
11
- - Added AST-based extraction for default prop values (`getDefaultsFromProps`) from `props.ts` and design wiki configurations (`getWikiDesign`) from `src/wiki/wiki.ts`.
11
+ - Added recursive scanning and parsing of all files in the `src/wiki/` directory (e.g. `wikiStyle.ts`, `wiki.ts`, `wikiDescriptions.ts`), merging all `wiki*` dictionaries and descriptions into a centralized AST cache (`wikiDesignCache`).
12
+ - Added AST evaluation for `PropertyAccessExpression` nodes, supporting `StorybookControl.*` (e.g. `'select'`, `'boolean'`, `'number'`, `'string'`) and `StorybookCategory.*` (e.g. `'Styles'`, `'Actions'`, `'Adaptive'`, `'ARIA'`) enum values.
13
+ - Added AST-based extraction for default prop values (`getDefaultsFromProps`) from `props.ts`.
12
14
  - Fixed TypeScript typing in `getSlots()` by removing unsupported `description` access on `StorybookSlotProperty`.
13
- - Updated unit tests in `src/classes/Design/__tests__/DesignWikiStorm.test.ts` to test AST metadata extraction.
15
+ - Updated unit tests in `src/classes/Design/__tests__/DesignWikiStorm.test.ts` to test AST metadata extraction, directory scanning, and enum evaluation.
14
16
 
15
17
  ## [1.1.1] - 2026-09-07
16
18
 
@@ -3608,10 +3608,41 @@ defineOptions({
3608
3608
  let n = A(t.getProjectName());
3609
3609
  return e.writeByPath(oe, `@forward "./src/styles/${n}/style.scss";`), this;
3610
3610
  }
3611
- }, Tr = class {
3611
+ }, Tr = {
3612
+ text: "text",
3613
+ string: "string",
3614
+ number: "number",
3615
+ boolean: "boolean",
3616
+ select: "select",
3617
+ array: "array",
3618
+ object: "object"
3619
+ }, Er = {
3620
+ actions: "Actions",
3621
+ adaptive: "Adaptive",
3622
+ aria: "ARIA",
3623
+ arrow: "Arrow",
3624
+ attributes: "Attributes",
3625
+ bars: "Bars",
3626
+ counter: "Counter",
3627
+ form: "Form",
3628
+ hook: "Hook",
3629
+ icon: "Icon",
3630
+ information: "Information",
3631
+ mask: "Mask",
3632
+ option: "Options",
3633
+ search: "Search",
3634
+ sort: "Sort",
3635
+ status: "Status",
3636
+ style: "Styles",
3637
+ technical: "Technical",
3638
+ text: "Text",
3639
+ value: "Values"
3640
+ }, Dr = class n {
3612
3641
  project;
3613
3642
  path;
3614
3643
  data;
3644
+ static wikiDesignCache;
3645
+ static wikiDescriptionsCache;
3615
3646
  wiki;
3616
3647
  dataComponent;
3617
3648
  constructor(e, t, n) {
@@ -3742,24 +3773,11 @@ defineOptions({
3742
3773
  getPaths(e) {
3743
3774
  return [...this.getDirs(), ...e];
3744
3775
  }
3776
+ getWikiDescriptions() {
3777
+ return n.wikiDescriptionsCache || this.loadWikiFiles(), n.wikiDescriptionsCache;
3778
+ }
3745
3779
  getWikiDesign() {
3746
- let t = [
3747
- ".",
3748
- "src",
3749
- "wiki",
3750
- "wiki.ts"
3751
- ];
3752
- if (e.is(t)) {
3753
- let n = e.readFileOnly(t);
3754
- if (n) {
3755
- let e = M.createSourceFile("wiki.ts", n, M.ScriptTarget.Latest, !0), t = this.extractVariables(e);
3756
- for (let [e, n] of t.entries()) if (e.startsWith("wiki")) {
3757
- let e = this.evalNode(n, t);
3758
- if (w(e)) return e;
3759
- }
3760
- }
3761
- }
3762
- return {};
3780
+ return n.wikiDesignCache ? n.wikiDesignCache : (this.loadWikiFiles(), n.wikiDesignCache ?? {});
3763
3781
  }
3764
3782
  cleanType(e) {
3765
3783
  let t = e.trim();
@@ -3803,6 +3821,13 @@ defineOptions({
3803
3821
  }
3804
3822
  return n;
3805
3823
  }
3824
+ if (M.isPropertyAccessExpression(e)) {
3825
+ let n = e.expression.getText().replace(/^['"]|['"]$/g, ""), r = e.name.text;
3826
+ if (n === "StorybookControl") return Tr[r] ?? r;
3827
+ if (n === "StorybookCategory") return Er[r] ?? r;
3828
+ let i = this.evalNode(e.expression, t);
3829
+ return w(i) && r in i ? i[r] : r;
3830
+ }
3806
3831
  if (M.isIdentifier(e)) {
3807
3832
  let n = e.text;
3808
3833
  return t.has(n) ? this.evalNode(t.get(n), t) : void 0;
@@ -3819,11 +3844,40 @@ defineOptions({
3819
3844
  async initWiki() {
3820
3845
  let e = await this.getData();
3821
3846
  if (e) {
3822
- let { WikiStorybook: t } = await import("@dxtmisha/wiki"), { wiki: n, wikiDescriptions: r } = await import("@dxtmisha/wiki/media");
3823
- return new t(e.component, e.props, e.defaults, e.wikiDesign, n, r);
3847
+ let { WikiStorybook: t } = await import("@dxtmisha/wiki"), { wiki: n, wikiDescriptions: r } = await import("@dxtmisha/wiki/media"), i = this.getWikiDescriptions(), a = i && i.length > 0 ? [...r, ...i] : r;
3848
+ return new t(e.component, e.props, e.defaults, e.wikiDesign, n, a);
3849
+ }
3850
+ }
3851
+ loadWikiFiles() {
3852
+ if (n.wikiDesignCache) return;
3853
+ let t = [[
3854
+ ".",
3855
+ "src",
3856
+ "wiki"
3857
+ ], ["src", "wiki"]].find((t) => e.is(t));
3858
+ if (!t) {
3859
+ n.wikiDesignCache = {};
3860
+ return;
3861
+ }
3862
+ let r = e.readDirRecursive(t).filter((e) => e.endsWith(".ts") || e.endsWith(".js")), i = /* @__PURE__ */ new Map();
3863
+ for (let n of r) {
3864
+ let r = [...t, n], a = e.readFileOnly(r);
3865
+ if (a) {
3866
+ let e = M.createSourceFile(n, a, M.ScriptTarget.Latest, !0), t = this.extractVariables(e);
3867
+ for (let [e, n] of t.entries()) i.set(e, n);
3868
+ }
3869
+ }
3870
+ let a = {};
3871
+ for (let [e, t] of i.entries()) if (e === "wikiDescriptions" || e.endsWith("Descriptions")) {
3872
+ let e = this.evalNode(t, i);
3873
+ S(e) && (n.wikiDescriptionsCache = e);
3874
+ } else if (e.startsWith("wiki")) {
3875
+ let e = this.evalNode(t, i);
3876
+ w(e) && Object.assign(a, e);
3824
3877
  }
3878
+ n.wikiDesignCache = a;
3825
3879
  }
3826
- }, Er = class {
3880
+ }, Or = class {
3827
3881
  dir;
3828
3882
  components;
3829
3883
  constructor(e = "dist") {
@@ -3849,7 +3903,7 @@ defineOptions({
3849
3903
  async getComponents() {
3850
3904
  let e = g(), t = [];
3851
3905
  if (e) for (let n of this.components.getComponentList()) {
3852
- let r = new Tr(e.name, this.components.getComponentsPath(), n);
3906
+ let r = new Dr(e.name, this.components.getComponentsPath(), n);
3853
3907
  await r.init();
3854
3908
  let i = await r.get();
3855
3909
  i && t.push(i);
@@ -3858,4 +3912,4 @@ defineOptions({
3858
3912
  }
3859
3913
  };
3860
3914
  //#endregion
3861
- export { Te as ComponentCreator, Rn as DesignConstructors, Kn as DesignFlags, wr as DesignUi, Er as DesignWikiStorm, fe as PackageInit };
3915
+ export { Te as ComponentCreator, Rn as DesignConstructors, Kn as DesignFlags, wr as DesignUi, Or as DesignWikiStorm, fe as PackageInit };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dxtmisha/scripts",
3
3
  "private": false,
4
- "version": "1.1.2",
4
+ "version": "1.1.3",
5
5
  "type": "module",
6
6
  "description": "CLI tools, AI integration scripts, and automation utilities for DXT UI — automated component scaffolding, Figma layout generation, library packaging, documentation building, screenshot captures, and AI prompt processing.",
7
7
  "keywords": [