@public-ui/kolibri-cli 4.0.0 → 4.0.1-rc.1

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.
@@ -12,8 +12,13 @@ class GenericRenameTagNameTask extends abstract_task_1.AbstractTask {
12
12
  newTagName;
13
13
  componentRegExp;
14
14
  componentImportRegExp;
15
+ componentNamedImportRegExp;
16
+ componentDefaultImportRegExp;
17
+ componentTypeImportRegExp;
18
+ componentRequireRegExp;
15
19
  customElementRegExp;
16
20
  newTagNameInCamelCase;
21
+ oldTagNameInCamelCase;
17
22
  constructor(identifier, description, oldTagName, newTagName, versionRange, dependentTasks = [], options = {}) {
18
23
  super(identifier, description, types_1.MARKUP_EXTENSIONS, versionRange, dependentTasks, options);
19
24
  this.newTagName = newTagName;
@@ -24,8 +29,20 @@ class GenericRenameTagNameTask extends abstract_task_1.AbstractTask {
24
29
  throw (0, reuse_1.logAndCreateError)(`Old Tag "${newTagName}" is not in kebab case.`);
25
30
  }
26
31
  this.newTagNameInCamelCase = (0, reuse_1.kebabToCapitalCase)(newTagName);
27
- this.componentRegExp = new RegExp(`([\\<\\/])${(0, reuse_1.kebabToCapitalCase)(oldTagName)}(\\s+[^\\>]*|\\>)`, 'g');
28
- this.componentImportRegExp = new RegExp(`([\\w {,\\r\\n]+)${(0, reuse_1.kebabToCapitalCase)(oldTagName)}([, ]\\s+[\\r\\n\\w },]+'@public-ui/react')`, 'g');
32
+ this.oldTagNameInCamelCase = (0, reuse_1.kebabToCapitalCase)(oldTagName);
33
+ // Tag replacement in JSX: <KolButton ... /> → <KolButtonNew ... />
34
+ this.componentRegExp = new RegExp(`([\\<\\/])${this.oldTagNameInCamelCase}(\\s+[^\\>]*|\\>)`, 'g');
35
+ // Legacy: React/Vue adapter imports with package restriction
36
+ this.componentImportRegExp = new RegExp(`([\\w {,\\r\\n]+)${this.oldTagNameInCamelCase}([, ]\\s+[\\r\\n\\w },]+'@public-ui\\/(?:react(?:-v19)?|vue)')`, 'g');
37
+ // ESM Named Imports: import { KolButton, ... } from '@public-ui/react-v19';
38
+ this.componentNamedImportRegExp = new RegExp(`(import\\s*{[^}]*?)\\b${this.oldTagNameInCamelCase}\\b([^}]*}\\s*from\\s*['"\`][^'"\`]*['"\`])`, 'g');
39
+ // ESM Default Imports: import KolButton from '@public-ui/react-v19';
40
+ this.componentDefaultImportRegExp = new RegExp(`import\\s+${this.oldTagNameInCamelCase}\\s+(from\\s+['"\`][^'"\`]*['"\`])`, 'g');
41
+ // TypeScript Type Imports: import type { KolButton } from '@public-ui/react-v19';
42
+ this.componentTypeImportRegExp = new RegExp(`(import\\s+type\\s*{[^}]*?)\\b${this.oldTagNameInCamelCase}\\b([^}]*}\\s*from\\s*['"\`][^'"\`]*['"\`])`, 'g');
43
+ // CommonJS Requires: const { KolButton } = require('@public-ui/react-v19');
44
+ this.componentRequireRegExp = new RegExp(`((?:const|var|let)\\s*{[^}]*?)\\b${this.oldTagNameInCamelCase}\\b([^}]*}\\s*=\\s*require\\(['"\`][^'"\`]*['"\`]\\))`, 'g');
45
+ // Custom element tag replacement in HTML: <kol-button ... /> → <kol-button-new ... />
29
46
  this.customElementRegExp = new RegExp(`([\\<\\/])${oldTagName}(\\s+[^\\>]*|\\>)`, 'g');
30
47
  }
31
48
  run(baseDir) {
@@ -35,10 +52,12 @@ class GenericRenameTagNameTask extends abstract_task_1.AbstractTask {
35
52
  transpileComponentFileRename(baseDir) {
36
53
  (0, reuse_1.filterFilesByExt)(baseDir, types_1.COMPONENT_FILE_EXTENSIONS).forEach((file) => {
37
54
  const content = fs_1.default.readFileSync(file, 'utf8');
38
- const newContent = content
39
- // Replacements
40
- .replace(this.componentRegExp, `$1${this.newTagNameInCamelCase}$2`)
41
- .replace(this.componentImportRegExp, `$1${this.newTagNameInCamelCase}$2`);
55
+ let newContent = content;
56
+ // Replace JSX/HTML tags
57
+ newContent = newContent.replace(this.componentRegExp, `$1${this.newTagNameInCamelCase}$2`);
58
+ // Replace ALL component name usages with a simple word-boundary pattern
59
+ // This catches: imports, const/var/let declarations, function calls, type annotations, etc.
60
+ newContent = newContent.replace(new RegExp(`\\b${this.oldTagNameInCamelCase}\\b`, 'g'), this.newTagNameInCamelCase);
42
61
  if (content !== newContent) {
43
62
  reuse_1.MODIFIED_FILES.add(file);
44
63
  fs_1.default.writeFileSync(file, newContent);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@public-ui/kolibri-cli",
3
- "version": "4.0.0",
3
+ "version": "4.0.1-rc.1",
4
4
  "license": "EUPL-1.2",
5
5
  "homepage": "https://public-ui.github.io",
6
6
  "repository": {
@@ -30,7 +30,7 @@
30
30
  "prettier-plugin-organize-imports": "4.3.0",
31
31
  "semver": "7.7.3",
32
32
  "typed-bem": "1.0.2",
33
- "@public-ui/components": "4.0.0"
33
+ "@public-ui/components": "4.0.1-rc.1"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "24.10.4",
@@ -43,7 +43,7 @@
43
43
  "eslint-plugin-json": "3.1.0",
44
44
  "eslint-plugin-jsx-a11y": "6.10.2",
45
45
  "eslint-plugin-react": "7.37.5",
46
- "knip": "5.80.0",
46
+ "knip": "5.80.1",
47
47
  "mocha": "11.7.5",
48
48
  "nodemon": "3.1.11",
49
49
  "ts-node": "10.9.2",