@dxtmisha/scripts 1.5.0 → 1.5.2

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
@@ -2,6 +2,63 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.5.2] - 2026-10-07
6
+
7
+ ### Added
8
+ - **Package Modification Date Tracking in `BuildPackages`**:
9
+ - Added `--date` (`-t`) CLI option to `dxt-build-packages` (`bin/build-packages.ts`) enabling rebuilds when package modification dates or git commit timestamps change.
10
+ - Added `BuildPackagesOptions` interface with `{ path, code, logFile, date }` configuration properties.
11
+ - Added `BuildPackageLogItem` interface (`{ version: string, date?: string }`) supporting structured build log entries.
12
+ - Added `getDate(packageFile)` method resolving commit timestamp via `GitRead.getFileDate()` with filesystem mtime fallback via `PropertiesFile.getTime()`.
13
+ - Added `getDateLog(name)` method to extract cached package timestamps from memory/file build logs.
14
+
15
+ ### Changed
16
+ - **`BuildPackages` Constructor & Options Refactoring**:
17
+ - Refactored `BuildPackages` constructor to accept a unified `BuildPackagesOptions` object instead of separate positional arguments.
18
+ - Enhanced `updateLog()` to record both `version` and `date` in `ui-build.log.json`.
19
+ - Updated `getVersionLog()` to maintain backward compatibility with both legacy string-based and new object-based log records.
20
+ - Updated `isUpdate()` logic to evaluate date invalidation when `date: true` option is enabled.
21
+ - Updated unit test suite in `BuildPackages.test.ts` covering object-based options, date-driven rebuild detection, and log persistence.
22
+
23
+ ## [1.5.1] - 2026-10-05
24
+
25
+ ### Added
26
+ - **`./ui` Export Subpath**:
27
+ - Added `"./ui"` export in `package.json` pointing to `./dist/library-ui.d.ts` and `./dist/library-ui.js`, enabling granular tree-shakeable imports of UI scaffolding and design system constructors (`ComponentCreator`, `DesignConstructors`, `DesignFlags`, `DesignUi`, `DesignWikiStorm`, `PackageInit`).
28
+
29
+ ### Changed
30
+ - **Lazy Initialization in `PropertiesConfig`**:
31
+ - Converted `PropertiesConfig.config` from an eager static property evaluated at module load time (`static { this.config = this.loadConfig() }`) to a lazy caching getter `get config()`, eliminating top-level module side effects and enabling complete tree shaking.
32
+ - **Lazy Initialization in `PropertiesFile`**:
33
+ - Converted `PropertiesFile.root` and `PropertiesFile.module` from eager static initialization to lazy getters `get root()` and `get module()`, moving directory resolution inside getter execution and eliminating static block evaluation.
34
+ - **Dependency & Peer Dependency Updates**:
35
+ - Updated dependencies `@dxtmisha/functional` (>=1.15.18), `@dxtmisha/functional-basic` (>=1.11.2), `@dxtmisha/media` (>=0.8.1), and `sass` (>=1.105.1).
36
+ - Updated optional peer dependencies including `@ai-sdk/xai`, `@anthropic-ai/sdk`, `@google/genai`, `ai`, `openai`, and `puppeteer`.
37
+
38
+ ### Fixed
39
+ - **Tree-Shaking Pure Annotations (`/*#__PURE__*/`)**:
40
+ - Added `/*#__PURE__*/` annotations to top-level `promisify(execFile)` in `src/functions/run.ts` and `src/classes/Build/BuildPublishPackages.ts`.
41
+ - Added `/*#__PURE__*/` annotation to top-level `AI_PROVIDER_REGISTRY = new Map(...)` in `src/composables/useAi.ts`, preventing bundlers from treating module initialization as an unshakeable side effect.
42
+ - **Resilient File Reading in `PropertiesFile`**:
43
+ - Added safe `try / catch` handling in `PropertiesFile.readFile` and `PropertiesFile.readFileOnly` to safely return `undefined` when reading non-existent, unreadable, or mocked files without throwing uncaught filesystem exceptions.
44
+
45
+ ## [1.5.0] - 2026-10-04
46
+
47
+ ### Added
48
+ - **`--library` Option in `dxt-component` CLI**:
49
+ - Added `--library` (`-l`) boolean option in `bin/design-component.ts` (default `false`) allowing explicit generation of library entry files when scaffolding new components.
50
+ - Added `makeLibrary()` method to `ComponentItem` (`src/classes/Component/ComponentItem.ts`) which conditionally creates `src/library/component-[Name].ts` exporting the component index.
51
+ - **Global AI Rules for Pure Annotations & PurgeCSS**:
52
+ - Added Rule 12 (**Mandatory Pure Annotations (`/*#__PURE__*/`)**) to `aiCodeGlobalPrompt.en.md` and `aiCodeGlobalPrompt.ru.md` requiring top-level calls, constructor invocations, and pure factory functions to be annotated with `/*#__PURE__*/` for dead-code elimination.
53
+ - Added Rule 13 (**PurgeCSS & CSS Tree-Shaking Compatibility**) to `aiCodeGlobalPrompt.en.md` and `aiCodeGlobalPrompt.ru.md` prohibiting dynamic class name string concatenation and requiring unbroken class name literals, dictionaries, or safelist blocks.
54
+
55
+ ### Changed
56
+ - **Default `isLibrary` Value in Component Generator**:
57
+ - Changed default constructor parameter `isLibrary: boolean = false` in `ComponentCreator` (`src/classes/Component/ComponentCreator.ts`).
58
+ - Changed default constructor parameter `isLibrary: boolean = false` in `ComponentItem` (`src/classes/Component/ComponentItem.ts`).
59
+ - Updated CLI instantiation in `bin/design-component.ts` to `new ComponentCreator(Boolean(values.library)).make()`.
60
+ - Updated test suites in `ComponentCreator.test.ts` and `ComponentItem.test.ts` to test default behavior and explicit `isLibrary: true` generation.
61
+
5
62
  ## [1.4.0] - 2026-09-23
6
63
 
7
64
  ### Added
@@ -6,13 +6,18 @@ import { BuildPackages } from '../dist/library.js'
6
6
 
7
7
  const { values } = parseCliArguments(
8
8
  'Scans, sorts, and builds monorepo packages managing build order by priorities.',
9
- 'Usage: dxt-build-packages [--code CODE] [--dir DIR] [--log LOG]',
9
+ 'Usage: dxt-build-packages [--code CODE] [--date] [--dir DIR] [--log LOG]',
10
10
  {
11
11
  code: {
12
12
  type: 'string',
13
13
  short: 'c',
14
14
  description: 'Custom build command or script name to execute'
15
15
  },
16
+ date: {
17
+ type: 'boolean',
18
+ short: 't',
19
+ description: 'Compare package modification date in addition to version'
20
+ },
16
21
  dir: {
17
22
  type: 'string',
18
23
  short: 'd',
@@ -29,8 +34,14 @@ const { values } = parseCliArguments(
29
34
  const dir = typeof values.dir === 'string' ? values.dir : undefined
30
35
  const code = typeof values.code === 'string' ? values.code : undefined
31
36
  const log = typeof values.log === 'string' ? values.log : undefined
37
+ const date = typeof values.date === 'boolean' ? values.date : undefined
32
38
 
33
- new BuildPackages(dir, code, log)
39
+ new BuildPackages({
40
+ path: dir,
41
+ code,
42
+ logFile: log,
43
+ date
44
+ })
34
45
  .make()
35
46
  .catch((error) => {
36
47
  console.error('dxt-build-packages failed:', error)
@@ -1,4 +1,4 @@
1
- import { t as e } from "./PropertiesConfig-BBsuNndv.js";
1
+ import { t as e } from "./PropertiesConfig-Cs_MJJNq.js";
2
2
  import { forEach as t, isFilled as n, random as r, sleep as i } from "@dxtmisha/functional-basic";
3
3
  //#region src/classes/Ai/AiAbstract.ts
4
4
  var a = class {
@@ -10,9 +10,25 @@ function m(e) {
10
10
  }
11
11
  //#endregion
12
12
  //#region src/classes/Properties/PropertiesFile.ts
13
- var h = d.dirname(f(import.meta.url)), g = class {
14
- static root;
15
- static module;
13
+ var h = class {
14
+ static _root;
15
+ static _module;
16
+ static get root() {
17
+ return this._root === void 0 && (this._root = process.cwd()), this._root;
18
+ }
19
+ static set root(e) {
20
+ this._root = e;
21
+ }
22
+ static get module() {
23
+ if (this._module === void 0) {
24
+ let e = d.dirname(f(import.meta.url));
25
+ this._module = !!e.match("node_modules");
26
+ }
27
+ return this._module;
28
+ }
29
+ static set module(e) {
30
+ this._module = e;
31
+ }
16
32
  static is(e) {
17
33
  return u.existsSync(this.joinPath(e));
18
34
  }
@@ -92,10 +108,18 @@ var h = d.dirname(f(import.meta.url)), g = class {
92
108
  }), a;
93
109
  }
94
110
  static readFile(e) {
95
- if (this.is(e)) return c(u.readFileSync(this.joinPath(e)).toString());
111
+ if (this.is(e)) try {
112
+ return c(u.readFileSync(this.joinPath(e)).toString());
113
+ } catch {
114
+ return;
115
+ }
96
116
  }
97
117
  static readFileOnly(e) {
98
- if (this.is(e)) return u.readFileSync(this.joinPath(e)).toString();
118
+ if (this.is(e)) try {
119
+ return u.readFileSync(this.joinPath(e)).toString();
120
+ } catch {
121
+ return;
122
+ }
99
123
  }
100
124
  static createDir(e) {
101
125
  let t = [this.root];
@@ -130,11 +154,14 @@ var h = d.dirname(f(import.meta.url)), g = class {
130
154
  static removeRootInPath(e) {
131
155
  return this.joinPath(e).replace(`${this.root}${d.sep}`, "").replace(`${this.root}`, "");
132
156
  }
133
- static {
134
- this.module = !!h.match("node_modules"), this.root = process.cwd();
157
+ }, g = class {
158
+ static _config;
159
+ static get config() {
160
+ return this._config ||= this.loadConfig(), this._config;
161
+ }
162
+ static set config(e) {
163
+ this._config = e;
135
164
  }
136
- }, _ = class {
137
- static config;
138
165
  static isPromptPackageOnly() {
139
166
  return !!this.config?.promptPackageOnly;
140
167
  }
@@ -217,9 +244,9 @@ var h = d.dirname(f(import.meta.url)), g = class {
217
244
  return this.config?.wikiLanguage ?? "en";
218
245
  }
219
246
  static getExtends(e, t = []) {
220
- let n = [...t, m(e)], r = this.getLocalPath(n), i = g.readFile(n), a = g.readFile(r), o = a?.extends ?? i?.extends;
247
+ let n = [...t, m(e)], r = this.getLocalPath(n), i = h.readFile(n), a = h.readFile(r), o = a?.extends ?? i?.extends;
221
248
  return o ? {
222
- ...this.getExtends(o, [g.getPathDir(n)]),
249
+ ...this.getExtends(o, [h.getPathDir(n)]),
223
250
  ...i,
224
251
  ...a
225
252
  } : {
@@ -239,12 +266,12 @@ var h = d.dirname(f(import.meta.url)), g = class {
239
266
  let t = [];
240
267
  for (let n = 0; n < 32; n++) {
241
268
  let n = [...t, e], r = this.getLocalPath(n);
242
- if (g.is(n) || g.is(r)) {
243
- let e = g.readFile(n), t = g.readFile(r);
269
+ if (h.is(n) || h.is(r)) {
270
+ let e = h.readFile(n), t = h.readFile(r);
244
271
  if (e || t) {
245
272
  let r = t?.extends ?? e?.extends;
246
273
  return r ? {
247
- ...this.getExtends(r, [g.getPathDir(n)]),
274
+ ...this.getExtends(r, [h.getPathDir(n)]),
248
275
  ...e,
249
276
  ...t
250
277
  } : {
@@ -257,9 +284,6 @@ var h = d.dirname(f(import.meta.url)), g = class {
257
284
  }
258
285
  return {};
259
286
  }
260
- static {
261
- this.config = this.loadConfig();
262
- }
263
287
  };
264
288
  //#endregion
265
- export { g as n, _ as t };
289
+ export { h as n, g as t };
@@ -1,2 +1,2 @@
1
- import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s, u as c } from "./AiZAi-3DWR6wJr.js";
1
+ import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s, u as c } from "./AiZAi-B0f94-JR.js";
2
2
  export { c as AiAbstract, o as AiClaude, t as AiClaudeLite, e as AiGoogle, i as AiGoogleLite, a as AiOpenAi, n as AiOpenAiLite, s as AiZAi, r as AiZAiLite };
@@ -1,4 +1,4 @@
1
- import { t as e } from "./PropertiesConfig-BBsuNndv.js";
1
+ import { t as e } from "./PropertiesConfig-Cs_MJJNq.js";
2
2
  import { n as t, t as n } from "./figmaApiTypes-CArSsNW8.js";
3
3
  //#region src/classes/FigmaApi.ts
4
4
  var r = class {
@@ -1,6 +1,6 @@
1
- import { n as e, t } from "./PropertiesConfig-BBsuNndv.js";
1
+ import { n as e, t } from "./PropertiesConfig-Cs_MJJNq.js";
2
2
  import { UI_DIRS_COMPONENTS as n, UI_DIRS_CONSTRUCTOR as r, UI_DIRS_ICONS as i, UI_DIRS_LIBRARY as a, UI_DIRS_STYLES as o, UI_DIRS_TOKENS as s, UI_DIRS_WIKI as c, UI_DIR_COMPONENTS as l, UI_DIR_CONSTRUCTOR as u, UI_DIR_DIST as d, UI_DIR_STRUCTURE as f, UI_EXTENSION_STYLE as p, UI_FILE_NAME_DESIGN as ee, UI_FILE_NAME_MEDIA as te, UI_FILE_NAME_PLUGIN as ne, UI_FILE_NAME_STYLE as re, UI_FILE_NAME_WIKI as ie, UI_FILE_PACKAGE as ae, UI_FILE_PROPERTY as m, UI_FILE_STYLE_PROPERTIES as oe, UI_FILE_STYLE_SCSS as se, UI_KEY_CUSTOM as ce, UI_PROJECT_CONSTRUCTOR_FULL_NAME as le, UI_PROJECT_CONSTRUCTOR_NAME as h, UI_PROPERTY_FOR_PROPS as ue, UI_STRUCTURE_CLASSES as de } from "./config.js";
3
- import { a as g, i as fe, n as _, r as v, t as y } from "./propertyTypes-CeW8CD8G.js";
3
+ import { a as g, i as fe, n as _, r as v, t as y } from "./propertyTypes-C2TYOJLH.js";
4
4
  import { ServerStorage as pe, copyObject as me, forEach as b, getColumn as x, isArray as S, isFilled as C, isNull as he, isObject as w, isObjectNotArray as T, isSelected as E, isString as ge, replaceComponentName as _e, replaceRecursive as D, splice as ve, strFill as ye, toArray as O, toCamelCase as k, toCamelCaseFirst as A, toKebabCase as j, uniqueArray as be } from "@dxtmisha/functional-basic";
5
5
  import M from "typescript";
6
6
  import * as xe from "sass";
package/dist/library.d.ts CHANGED
@@ -991,6 +991,18 @@ export declare class BrowserItem {
991
991
  protected toConsole(text: string): void;
992
992
  }
993
993
 
994
+ /**
995
+ * Cached package build log entry.
996
+ *
997
+ * Запись лога сборки пакета в кэше.
998
+ */
999
+ export declare interface BuildPackageLogItem {
1000
+ /** Package version / Версия пакета */
1001
+ version: string;
1002
+ /** Last modification date or commit timestamp / Дата последнего изменения или временная метка коммита */
1003
+ date?: string;
1004
+ }
1005
+
994
1006
  /**
995
1007
  * Orchestrator for scanning, sorting, and building monorepo packages.
996
1008
  * Manages build order based on package priorities and tracks build versions via log cache.
@@ -999,20 +1011,20 @@ export declare class BrowserItem {
999
1011
  * Управляет порядком сборки на основе приоритетов пакетов и отслеживает версии сборки через лог-кэш.
1000
1012
  */
1001
1013
  export declare class BuildPackages {
1014
+ protected readonly options: BuildPackagesOptions;
1015
+ /** Map of cached package build logs / Карта кэшированных логов сборки пакетов */
1016
+ protected log: Record<string, BuildPackageLogItem | string>;
1002
1017
  protected readonly path: string;
1003
- protected readonly code?: string | undefined;
1004
- protected readonly logFile?: string | undefined;
1005
- /** Map of cached package build versions / Карта кэшированных версий сборки пакетов */
1006
- protected log: Record<string, string>;
1018
+ protected readonly code?: string;
1019
+ protected readonly logFile?: string;
1020
+ protected readonly date?: boolean;
1007
1021
  /**
1008
- * Constructor initializes packages path, custom build code, custom log file, and loads build log.
1022
+ * Constructor initializes packages path, custom build code, custom log file, date comparison flag, and loads build log.
1009
1023
  *
1010
- * Конструктор инициализирует путь к пакетам, пользовательский код сборки, пользовательский файл лога и загружает лог сборки.
1011
- * @param path packages directory path / путь к директории пакетов
1012
- * @param code custom build command or script name / пользовательская команда сборки или имя скрипта
1013
- * @param logFile custom log file name or path / пользовательское имя или путь к файлу лога
1024
+ * Конструктор инициализирует путь к пакетам, пользовательский код сборки, пользовательский файл лога, флаг сравнения дат и загружает лог сборки.
1025
+ * @param options configuration options / параметры конфигурации
1014
1026
  */
1015
- constructor(path?: string, code?: string | undefined, logFile?: string | undefined);
1027
+ constructor(options?: BuildPackagesOptions);
1016
1028
  /**
1017
1029
  * Scans the packages directory and builds each package that contains a package.json.
1018
1030
  *
@@ -1024,7 +1036,7 @@ export declare class BuildPackages {
1024
1036
  *
1025
1037
  * Проверяет, нужно ли обновлять пакет.
1026
1038
  * @param packageFile package file object / объект файла пакета
1027
- * @returns true if version differs from log cache / true, если версия отличается от кэша лога
1039
+ * @returns true if version or modification date differs from log cache / true, если версия или дата изменения отличается от кэша лога
1028
1040
  */
1029
1041
  protected isUpdate(packageFile: PackageFile): boolean;
1030
1042
  /**
@@ -1035,6 +1047,22 @@ export declare class BuildPackages {
1035
1047
  * @returns command string or undefined / строка команды или undefined
1036
1048
  */
1037
1049
  protected getCode(packageFile: PackageFile): string | undefined;
1050
+ /**
1051
+ * Returns the last modification date of the package.
1052
+ *
1053
+ * Возвращает дату последнего изменения пакета.
1054
+ * @param packageFile package file instance / экземпляр файла пакета
1055
+ * @returns commit date string / строка даты коммита
1056
+ */
1057
+ protected getDate(packageFile: PackageFile): string;
1058
+ /**
1059
+ * Returns the cached modification date of the package from the build log.
1060
+ *
1061
+ * Возвращает кэшированную дату изменения пакета из лога сборки.
1062
+ * @param name package name / имя пакета
1063
+ * @returns cached date string or undefined / строка кэшированной даты или undefined
1064
+ */
1065
+ protected getDateLog(name: string): string | undefined;
1038
1066
  /**
1039
1067
  * Returns the path segments to the build log file.
1040
1068
  *
@@ -1051,9 +1079,9 @@ export declare class BuildPackages {
1051
1079
  */
1052
1080
  protected getVersionLog(name: string): string;
1053
1081
  /**
1054
- * Updates the build log with the current package version in memory.
1082
+ * Updates the build log with the current package version and date in memory.
1055
1083
  *
1056
- * Обновляет лог сборки текущей версией пакета в памяти.
1084
+ * Обновляет лог сборки текущей версией и датой пакета в памяти.
1057
1085
  * @param packageFile package file object / объект файла пакета
1058
1086
  */
1059
1087
  protected updateLog(packageFile: PackageFile): void;
@@ -1088,6 +1116,22 @@ export declare class BuildPackages {
1088
1116
  private getList;
1089
1117
  }
1090
1118
 
1119
+ /**
1120
+ * Configuration options for BuildPackages.
1121
+ *
1122
+ * Параметры конфигурации для BuildPackages.
1123
+ */
1124
+ export declare interface BuildPackagesOptions {
1125
+ /** Directory path to packages / Путь к директории пакетов */
1126
+ path?: string;
1127
+ /** Custom build command or script name / Пользовательская команда сборки или имя скрипта */
1128
+ code?: string;
1129
+ /** Custom log file name or path / Пользовательское имя или путь к файлу лога */
1130
+ logFile?: string;
1131
+ /** Whether to compare package modification date in addition to version / Сравнивать ли дату изменения пакета дополнительно к версии */
1132
+ date?: boolean;
1133
+ }
1134
+
1091
1135
  /**
1092
1136
  * Orchestrator for scanning and publishing changed packages to the npm registry.
1093
1137
  * Compares current package versions against published versions in npm and publishes updated packages.
@@ -4393,8 +4437,40 @@ declare interface PackageJsonData {
4393
4437
  * Этот класс предоставляет стандартизированный интерфейс для всех операций ввода-вывода в рамках дизайн-системы, включая нормализацию путей, рекурсивный обход директорий, синхронное чтение/запись файлов и получение метаданных. Он абстрагирует различия путей в разных ОС и обеспечивает согласованную обработку данных во всей цепочке инструментов.
4394
4438
  */
4395
4439
  export declare class PropertiesFile {
4396
- protected static root: string;
4397
- protected static module: boolean;
4440
+ protected static _root?: string;
4441
+ protected static _module?: boolean;
4442
+ /**
4443
+ * Root directory path (lazily evaluated).
4444
+ *
4445
+ * Корневой путь директории (ленивая инициализация).
4446
+ * @returns root path / корневой путь
4447
+ * @protected
4448
+ */
4449
+ protected static get root(): string;
4450
+ /**
4451
+ * Sets the root directory path.
4452
+ *
4453
+ * Устанавливает корневой путь директории.
4454
+ * @param value root path / корневой путь
4455
+ * @protected
4456
+ */
4457
+ protected static set root(value: string | undefined);
4458
+ /**
4459
+ * Whether the package is connected as a module (lazily evaluated).
4460
+ *
4461
+ * Подключен ли пакет как модуль (ленивая инициализация).
4462
+ * @returns boolean
4463
+ * @protected
4464
+ */
4465
+ protected static get module(): boolean;
4466
+ /**
4467
+ * Sets whether the package is connected as a module.
4468
+ *
4469
+ * Устанавливает, подключен ли пакет как модуль.
4470
+ * @param value boolean
4471
+ * @protected
4472
+ */
4473
+ protected static set module(value: boolean | undefined);
4398
4474
  /**
4399
4475
  * Synchronously checks for the existence of a file or directory at the specified path.
4400
4476
  *