@public-ui/kolibri-cli 4.0.0-alpha.6 → 4.0.0-alpha.9
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.
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.v4Tasks = void 0;
|
|
4
4
|
const id_1 = require("./id");
|
|
5
|
+
const link_1 = require("./link");
|
|
6
|
+
const loader_1 = require("./loader");
|
|
5
7
|
const msg_1 = require("./msg");
|
|
6
8
|
const toast_1 = require("./toast");
|
|
7
9
|
const toaster_1 = require("./toaster");
|
|
8
10
|
exports.v4Tasks = [];
|
|
11
|
+
exports.v4Tasks.push(...link_1.MapVariantStandaloneToInlineTasks);
|
|
9
12
|
exports.v4Tasks.push(...id_1.RemoveIdPropTasks);
|
|
10
13
|
exports.v4Tasks.push(...msg_1.RemoveMsgPropsTasks);
|
|
11
14
|
exports.v4Tasks.push(toast_1.RemoveToastVariantTask.getInstance('^4'));
|
|
12
15
|
exports.v4Tasks.push(toaster_1.RemoveToasterGetInstanceOptionsTask.getInstance('^4'));
|
|
16
|
+
exports.v4Tasks.push(loader_1.UpdateLoaderImportPathTask.getInstance('^4'));
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MapVariantStandaloneToInlineTasks = exports.MapLinkVariantStandaloneToInlineTask = exports.MapButtonLinkVariantStandaloneToInlineTask = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const types_1 = require("../../../../types");
|
|
9
|
+
const reuse_1 = require("../../../shares/reuse");
|
|
10
|
+
const abstract_task_1 = require("../../abstract-task");
|
|
11
|
+
class MapVariantStandaloneToInlineTask extends abstract_task_1.AbstractTask {
|
|
12
|
+
tag;
|
|
13
|
+
tagCapitalCase;
|
|
14
|
+
variantStandaloneRegExp = /\s_variant\s*=\s*(\{["'`]standalone["'`]\}|["'`]standalone["'`])/;
|
|
15
|
+
constructor(identifier, tag, versionRange, dependentTasks, options) {
|
|
16
|
+
super(identifier, `Map "_variant=standalone" to "_inline" for "${tag}"`, types_1.MARKUP_EXTENSIONS, versionRange, dependentTasks, options);
|
|
17
|
+
this.tag = tag;
|
|
18
|
+
this.tagCapitalCase = (0, reuse_1.kebabToCapitalCase)(tag);
|
|
19
|
+
}
|
|
20
|
+
static getInstance(tag, versionRange, dependentTasks, options) {
|
|
21
|
+
const identifier = `${tag}-map-variant-standalone-to-inline`;
|
|
22
|
+
if (!this.instances.has(identifier)) {
|
|
23
|
+
this.instances.set(identifier, new MapVariantStandaloneToInlineTask(identifier, tag, versionRange, dependentTasks, options));
|
|
24
|
+
}
|
|
25
|
+
return this.instances.get(identifier);
|
|
26
|
+
}
|
|
27
|
+
run(baseDir) {
|
|
28
|
+
this.transpileComponentFiles(baseDir);
|
|
29
|
+
this.transpileCustomElementFiles(baseDir);
|
|
30
|
+
}
|
|
31
|
+
transpileComponentFiles(baseDir) {
|
|
32
|
+
const tagRegExp = new RegExp(`<${this.tagCapitalCase}[^>]*_variant[^>]*>`, 'g');
|
|
33
|
+
(0, reuse_1.filterFilesByExt)(baseDir, types_1.COMPONENT_FILE_EXTENSIONS).forEach((file) => {
|
|
34
|
+
const content = fs_1.default.readFileSync(file, 'utf8');
|
|
35
|
+
const newContent = content.replace(tagRegExp, (componentTag) => this.rewriteTag(componentTag, true));
|
|
36
|
+
if (content !== newContent) {
|
|
37
|
+
reuse_1.MODIFIED_FILES.add(file);
|
|
38
|
+
fs_1.default.writeFileSync(file, newContent);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
transpileCustomElementFiles(baseDir) {
|
|
43
|
+
const tagRegExp = new RegExp(`<${this.tag}[^>]*_variant[^>]*>`, 'g');
|
|
44
|
+
(0, reuse_1.filterFilesByExt)(baseDir, types_1.CUSTOM_ELEMENT_FILE_EXTENSIONS).forEach((file) => {
|
|
45
|
+
const content = fs_1.default.readFileSync(file, 'utf8');
|
|
46
|
+
const newContent = content.replace(tagRegExp, (componentTag) => this.rewriteTag(componentTag, false));
|
|
47
|
+
if (content !== newContent) {
|
|
48
|
+
reuse_1.MODIFIED_FILES.add(file);
|
|
49
|
+
fs_1.default.writeFileSync(file, newContent);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
rewriteTag(componentTag, isComponent) {
|
|
54
|
+
if (!this.variantStandaloneRegExp.test(componentTag)) {
|
|
55
|
+
return componentTag;
|
|
56
|
+
}
|
|
57
|
+
const inlineReplacement = isComponent ? ' _inline={false}' : ' _inline="false"';
|
|
58
|
+
if (/\s_inline\s*=/.test(componentTag)) {
|
|
59
|
+
return componentTag.replace(this.variantStandaloneRegExp, '');
|
|
60
|
+
}
|
|
61
|
+
return componentTag.replace(this.variantStandaloneRegExp, inlineReplacement);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.MapButtonLinkVariantStandaloneToInlineTask = MapVariantStandaloneToInlineTask.getInstance('kol-button-link', '^4');
|
|
65
|
+
exports.MapLinkVariantStandaloneToInlineTask = MapVariantStandaloneToInlineTask.getInstance('kol-link', '^4');
|
|
66
|
+
exports.MapVariantStandaloneToInlineTasks = [exports.MapButtonLinkVariantStandaloneToInlineTask, exports.MapLinkVariantStandaloneToInlineTask];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.UpdateLoaderImportPathTask = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const reuse_1 = require("../../../shares/reuse");
|
|
9
|
+
const abstract_task_1 = require("../../abstract-task");
|
|
10
|
+
const LOADER_FILE_EXTENSIONS = ['js', 'jsx', 'ts', 'tsx', 'vue'];
|
|
11
|
+
class UpdateLoaderImportPathTask extends abstract_task_1.AbstractTask {
|
|
12
|
+
constructor(identifier, versionRange, dependentTasks, options) {
|
|
13
|
+
super(identifier, 'Update loader imports to @public-ui/components/loader', LOADER_FILE_EXTENSIONS, versionRange, dependentTasks, options);
|
|
14
|
+
}
|
|
15
|
+
static getInstance(versionRange, dependentTasks = [], options = {}) {
|
|
16
|
+
const identifier = `update-loader-import-path-${versionRange}`;
|
|
17
|
+
if (!this.instances.has(identifier)) {
|
|
18
|
+
this.instances.set(identifier, new UpdateLoaderImportPathTask(identifier, versionRange, dependentTasks, options));
|
|
19
|
+
}
|
|
20
|
+
return this.instances.get(identifier);
|
|
21
|
+
}
|
|
22
|
+
run(baseDir) {
|
|
23
|
+
this.transpileFiles(baseDir);
|
|
24
|
+
}
|
|
25
|
+
transpileFiles(baseDir) {
|
|
26
|
+
(0, reuse_1.filterFilesByExt)(baseDir, LOADER_FILE_EXTENSIONS).forEach((file) => {
|
|
27
|
+
const content = fs_1.default.readFileSync(file, 'utf8');
|
|
28
|
+
const newContent = content.replace(/@public-ui\/components\/dist\/loader/g, '@public-ui/components/loader');
|
|
29
|
+
if (newContent !== content) {
|
|
30
|
+
reuse_1.MODIFIED_FILES.add(file);
|
|
31
|
+
fs_1.default.writeFileSync(file, newContent);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.UpdateLoaderImportPathTask = UpdateLoaderImportPathTask;
|
|
@@ -177,7 +177,10 @@ function setRemoveMode(mode) {
|
|
|
177
177
|
REMOVE_MODE = mode;
|
|
178
178
|
}
|
|
179
179
|
/**
|
|
180
|
-
* Gets the remove mode
|
|
180
|
+
* Gets the current remove mode chosen via the CLI flag `--remove-mode`.
|
|
181
|
+
* - `prefix` (default) renames removed properties to `data-removed-<property>` so that developers can
|
|
182
|
+
* clean them up manually after the migration.
|
|
183
|
+
* - `delete` removes the properties entirely during migration.
|
|
181
184
|
* @returns {RemoveMode} The remove mode
|
|
182
185
|
*/
|
|
183
186
|
function getRemoveMode() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@public-ui/kolibri-cli",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.9",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"homepage": "https://public-ui.github.io",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"deepmerge": "4.3.1",
|
|
27
27
|
"gradient-string": "3.0.0",
|
|
28
28
|
"loglevel": "1.9.2",
|
|
29
|
-
"prettier": "3.7.
|
|
29
|
+
"prettier": "3.7.4",
|
|
30
30
|
"prettier-plugin-organize-imports": "4.3.0",
|
|
31
31
|
"semver": "7.7.3",
|
|
32
32
|
"typed-bem": "1.0.2"
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"eslint-plugin-json": "3.1.0",
|
|
45
45
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
46
46
|
"eslint-plugin-react": "7.37.5",
|
|
47
|
-
"knip": "5.
|
|
47
|
+
"knip": "5.71.0",
|
|
48
48
|
"mocha": "11.7.5",
|
|
49
49
|
"nodemon": "3.1.11",
|
|
50
50
|
"rimraf": "6.1.2",
|
|
51
51
|
"ts-node": "10.9.2",
|
|
52
52
|
"typescript": "5.9.3",
|
|
53
|
-
"@public-ui/components": "4.0.0-alpha.
|
|
53
|
+
"@public-ui/components": "4.0.0-alpha.9"
|
|
54
54
|
},
|
|
55
55
|
"files": [
|
|
56
56
|
"dist"
|