@superblocksteam/sdk 2.0.41-next.53 → 2.0.41-next.7
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/.turbo/turbo-build.log +1 -1
- package/dist/application-build.d.mts.map +1 -1
- package/dist/application-build.mjs +0 -2
- package/dist/application-build.mjs.map +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -18
- package/dist/client.js.map +1 -1
- package/dist/dev-utils/dev-server.d.mts.map +1 -1
- package/dist/dev-utils/dev-server.mjs +2 -4
- package/dist/dev-utils/dev-server.mjs.map +1 -1
- package/dist/version-control.d.mts +0 -4
- package/dist/version-control.d.mts.map +1 -1
- package/dist/version-control.mjs +0 -13
- package/dist/version-control.mjs.map +1 -1
- package/package.json +5 -5
- package/src/application-build.mts +1 -2
- package/src/client.ts +3 -19
- package/src/dev-utils/dev-server.mts +3 -4
- package/src/version-control.mts +0 -13
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/vite-plugin-optimize-lucide-imports.d.ts +0 -8
- package/dist/vite-plugin-optimize-lucide-imports.d.ts.map +0 -1
- package/dist/vite-plugin-optimize-lucide-imports.js +0 -96
- package/dist/vite-plugin-optimize-lucide-imports.js.map +0 -1
- package/src/vite-plugin-optimize-lucide-imports.ts +0 -128
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from "vite";
|
|
2
|
-
/**
|
|
3
|
-
* A Vite plugin that optimizes lucide-react imports by converting
|
|
4
|
-
* destructured imports to direct imports for better tree-shaking
|
|
5
|
-
*/
|
|
6
|
-
declare function createLucideReactImportOptimizer(): Plugin;
|
|
7
|
-
export default createLucideReactImportOptimizer;
|
|
8
|
-
//# sourceMappingURL=vite-plugin-optimize-lucide-imports.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-optimize-lucide-imports.d.ts","sourceRoot":"","sources":["../src/vite-plugin-optimize-lucide-imports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,MAAM,EAAE,MAAM,MAAM,CAAC;AAMpD;;;GAGG;AACH,iBAAS,gCAAgC,IAAI,MAAM,CA8BlD;AAuFD,eAAe,gCAAgC,CAAC"}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
// Pre-compile regex for better performance
|
|
2
|
-
const LUCIDE_IMPORT_PATTERN = /([ \t]*)import\s+\{\s*([^}]+)\s*\}\s+from\s+['"]lucide-react['"]/g;
|
|
3
|
-
/**
|
|
4
|
-
* A Vite plugin that optimizes lucide-react imports by converting
|
|
5
|
-
* destructured imports to direct imports for better tree-shaking
|
|
6
|
-
*/
|
|
7
|
-
function createLucideReactImportOptimizer() {
|
|
8
|
-
return {
|
|
9
|
-
name: "lucide-react-import-optimizer",
|
|
10
|
-
transform(sourceCode, filePath) {
|
|
11
|
-
if (!isValidInput(sourceCode, filePath))
|
|
12
|
-
return null;
|
|
13
|
-
try {
|
|
14
|
-
// Quick check if the file contains lucide-astro imports
|
|
15
|
-
if (!sourceCode.includes("lucide-react"))
|
|
16
|
-
return null;
|
|
17
|
-
const { transformedCode, hasChanges } = transformLucideImports(sourceCode);
|
|
18
|
-
if (hasChanges) {
|
|
19
|
-
return {
|
|
20
|
-
code: transformedCode,
|
|
21
|
-
map: null, // No source maps in this implementation
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
catch (error) {
|
|
27
|
-
handleTransformError(error);
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Validates the input parameters for processing
|
|
35
|
-
*/
|
|
36
|
-
function isValidInput(code, id) {
|
|
37
|
-
return Boolean(code && id);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Transforms lucide-react imports from destructured to individual imports
|
|
41
|
-
*/
|
|
42
|
-
function transformLucideImports(sourceCode) {
|
|
43
|
-
let hasChanges = false;
|
|
44
|
-
const transformedCode = sourceCode.replace(LUCIDE_IMPORT_PATTERN, (match, indentation, importNames) => {
|
|
45
|
-
if (!importNames.trim())
|
|
46
|
-
return match;
|
|
47
|
-
const semicolonAtEnd = match.endsWith(";");
|
|
48
|
-
const individualImports = convertToIndividualImports(importNames, indentation, semicolonAtEnd);
|
|
49
|
-
if (individualImports) {
|
|
50
|
-
hasChanges = true;
|
|
51
|
-
return individualImports;
|
|
52
|
-
}
|
|
53
|
-
return match;
|
|
54
|
-
});
|
|
55
|
-
return { transformedCode, hasChanges };
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Converts a comma-separated list of imports to individual import statements
|
|
59
|
-
*/
|
|
60
|
-
function convertToIndividualImports(importNames, indentation, withSemicolon) {
|
|
61
|
-
return importNames
|
|
62
|
-
.split(",")
|
|
63
|
-
.map((name) => name.trim())
|
|
64
|
-
.filter(Boolean)
|
|
65
|
-
.map((name) => {
|
|
66
|
-
const kebabCasePath = convertToKebabCase(name);
|
|
67
|
-
const semicolon = withSemicolon ? ";" : "";
|
|
68
|
-
return `${indentation}import ${name} from "lucide-react/dist/esm/icons/${kebabCasePath}"${semicolon}`;
|
|
69
|
-
})
|
|
70
|
-
.join("\n");
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Converts a camelCase or PascalCase string to kebab-case
|
|
74
|
-
* Should handle cases like:
|
|
75
|
-
* - CheckIcon -> check
|
|
76
|
-
* - BluetoothConnectedIcon -> bluetooth-connected
|
|
77
|
-
* - XIcon -> x
|
|
78
|
-
* - Loader2Icon -> loader-2
|
|
79
|
-
* - Grid2X2CheckIcon -> grid-2-x-2-check
|
|
80
|
-
*/
|
|
81
|
-
function convertToKebabCase(str) {
|
|
82
|
-
return str
|
|
83
|
-
.replace("Icon", "")
|
|
84
|
-
.replace(/([a-z0-9])([A-Z])/g, "$1-$2")
|
|
85
|
-
.replace(/([a-zA-Z])([0-9])/g, "$1-$2")
|
|
86
|
-
.toLowerCase();
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Handles and logs transformation errors
|
|
90
|
-
*/
|
|
91
|
-
function handleTransformError(error) {
|
|
92
|
-
const typedError = error instanceof Error ? error : new Error(String(error));
|
|
93
|
-
console.error("Error in lucide-react-import-optimizer plugin:", typedError);
|
|
94
|
-
}
|
|
95
|
-
export default createLucideReactImportOptimizer;
|
|
96
|
-
//# sourceMappingURL=vite-plugin-optimize-lucide-imports.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-optimize-lucide-imports.js","sourceRoot":"","sources":["../src/vite-plugin-optimize-lucide-imports.ts"],"names":[],"mappings":"AAEA,2CAA2C;AAC3C,MAAM,qBAAqB,GACzB,mEAAmE,CAAC;AAEtE;;;GAGG;AACH,SAAS,gCAAgC;IACvC,OAAO;QACL,IAAI,EAAE,+BAA+B;QACrC,SAAS,CACP,UAAkB,EAClB,QAAgB;YAEhB,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,QAAQ,CAAC;gBAAE,OAAO,IAAI,CAAC;YAErD,IAAI,CAAC;gBACH,wDAAwD;gBACxD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC;oBAAE,OAAO,IAAI,CAAC;gBAEtD,MAAM,EAAE,eAAe,EAAE,UAAU,EAAE,GACnC,sBAAsB,CAAC,UAAU,CAAC,CAAC;gBAErC,IAAI,UAAU,EAAE,CAAC;oBACf,OAAO;wBACL,IAAI,EAAE,eAAe;wBACrB,GAAG,EAAE,IAAI,EAAE,wCAAwC;qBACpD,CAAC;gBACJ,CAAC;gBAED,OAAO,IAAI,CAAC;YACd,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,oBAAoB,CAAC,KAAK,CAAC,CAAC;gBAC5B,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,IAAY,EAAE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;AAChB,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,kBAAkB,CAAC,GAAW;IACrC,OAAO,GAAG;SACP,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;SACnB,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC;SACtC,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC;SACtC,WAAW,EAAE,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,SAAS,oBAAoB,CAAC,KAAc;IAC1C,MAAM,UAAU,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7E,OAAO,CAAC,KAAK,CAAC,gDAAgD,EAAE,UAAU,CAAC,CAAC;AAC9E,CAAC;AAED,eAAe,gCAAgC,CAAC"}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import type { TransformResult, Plugin } from "vite";
|
|
2
|
-
|
|
3
|
-
// Pre-compile regex for better performance
|
|
4
|
-
const LUCIDE_IMPORT_PATTERN =
|
|
5
|
-
/([ \t]*)import\s+\{\s*([^}]+)\s*\}\s+from\s+['"]lucide-react['"]/g;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* A Vite plugin that optimizes lucide-react imports by converting
|
|
9
|
-
* destructured imports to direct imports for better tree-shaking
|
|
10
|
-
*/
|
|
11
|
-
function createLucideReactImportOptimizer(): Plugin {
|
|
12
|
-
return {
|
|
13
|
-
name: "lucide-react-import-optimizer",
|
|
14
|
-
transform(
|
|
15
|
-
sourceCode: string,
|
|
16
|
-
filePath: string,
|
|
17
|
-
): TransformResult | null | undefined {
|
|
18
|
-
if (!isValidInput(sourceCode, filePath)) return null;
|
|
19
|
-
|
|
20
|
-
try {
|
|
21
|
-
// Quick check if the file contains lucide-astro imports
|
|
22
|
-
if (!sourceCode.includes("lucide-react")) return null;
|
|
23
|
-
|
|
24
|
-
const { transformedCode, hasChanges } =
|
|
25
|
-
transformLucideImports(sourceCode);
|
|
26
|
-
|
|
27
|
-
if (hasChanges) {
|
|
28
|
-
return {
|
|
29
|
-
code: transformedCode,
|
|
30
|
-
map: null, // No source maps in this implementation
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return null;
|
|
35
|
-
} catch (error) {
|
|
36
|
-
handleTransformError(error);
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Validates the input parameters for processing
|
|
45
|
-
*/
|
|
46
|
-
function isValidInput(code: string, id: string): boolean {
|
|
47
|
-
return Boolean(code && id);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Transforms lucide-react imports from destructured to individual imports
|
|
52
|
-
*/
|
|
53
|
-
function transformLucideImports(sourceCode: string): {
|
|
54
|
-
transformedCode: string;
|
|
55
|
-
hasChanges: boolean;
|
|
56
|
-
} {
|
|
57
|
-
let hasChanges = false;
|
|
58
|
-
|
|
59
|
-
const transformedCode = sourceCode.replace(
|
|
60
|
-
LUCIDE_IMPORT_PATTERN,
|
|
61
|
-
(match: string, indentation: string, importNames: string): string => {
|
|
62
|
-
if (!importNames.trim()) return match;
|
|
63
|
-
|
|
64
|
-
const semicolonAtEnd = match.endsWith(";");
|
|
65
|
-
const individualImports = convertToIndividualImports(
|
|
66
|
-
importNames,
|
|
67
|
-
indentation,
|
|
68
|
-
semicolonAtEnd,
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
if (individualImports) {
|
|
72
|
-
hasChanges = true;
|
|
73
|
-
return individualImports;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return match;
|
|
77
|
-
},
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
return { transformedCode, hasChanges };
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Converts a comma-separated list of imports to individual import statements
|
|
85
|
-
*/
|
|
86
|
-
function convertToIndividualImports(
|
|
87
|
-
importNames: string,
|
|
88
|
-
indentation: string,
|
|
89
|
-
withSemicolon: boolean,
|
|
90
|
-
): string {
|
|
91
|
-
return importNames
|
|
92
|
-
.split(",")
|
|
93
|
-
.map((name) => name.trim())
|
|
94
|
-
.filter(Boolean)
|
|
95
|
-
.map((name) => {
|
|
96
|
-
const kebabCasePath = convertToKebabCase(name);
|
|
97
|
-
const semicolon = withSemicolon ? ";" : "";
|
|
98
|
-
return `${indentation}import ${name} from "lucide-react/dist/esm/icons/${kebabCasePath}"${semicolon}`;
|
|
99
|
-
})
|
|
100
|
-
.join("\n");
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Converts a camelCase or PascalCase string to kebab-case
|
|
105
|
-
* Should handle cases like:
|
|
106
|
-
* - CheckIcon -> check
|
|
107
|
-
* - BluetoothConnectedIcon -> bluetooth-connected
|
|
108
|
-
* - XIcon -> x
|
|
109
|
-
* - Loader2Icon -> loader-2
|
|
110
|
-
* - Grid2X2CheckIcon -> grid-2-x-2-check
|
|
111
|
-
*/
|
|
112
|
-
function convertToKebabCase(str: string): string {
|
|
113
|
-
return str
|
|
114
|
-
.replace("Icon", "")
|
|
115
|
-
.replace(/([a-z0-9])([A-Z])/g, "$1-$2")
|
|
116
|
-
.replace(/([a-zA-Z])([0-9])/g, "$1-$2")
|
|
117
|
-
.toLowerCase();
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Handles and logs transformation errors
|
|
122
|
-
*/
|
|
123
|
-
function handleTransformError(error: unknown): void {
|
|
124
|
-
const typedError = error instanceof Error ? error : new Error(String(error));
|
|
125
|
-
console.error("Error in lucide-react-import-optimizer plugin:", typedError);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export default createLucideReactImportOptimizer;
|