@blocklet/pages-kit 0.4.40 → 0.4.41
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.
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { BuiltinModulesGlobalVariableName } from '../../types/builtin';
|
|
2
2
|
export const isRelativeModule = (moduleSpecifier) => {
|
|
3
|
+
if (!moduleSpecifier) {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
3
6
|
return moduleSpecifier.startsWith('./') || moduleSpecifier.startsWith('../');
|
|
4
7
|
};
|
|
5
8
|
export const isAwaitModule = (moduleSpecifier) => {
|
|
9
|
+
if (!moduleSpecifier) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
6
12
|
return ['@blocklet/pages-kit/builtin/async/ai-runtime'].includes(moduleSpecifier);
|
|
7
13
|
};
|
|
8
14
|
export const createBuiltinModuleTransformer = (ts) => (context) => (file) => {
|
|
@@ -11,6 +17,9 @@ export const createBuiltinModuleTransformer = (ts) => (context) => (file) => {
|
|
|
11
17
|
const imports = [];
|
|
12
18
|
// check if the module is a target module
|
|
13
19
|
const isTargetModule = (moduleSpecifier) => {
|
|
20
|
+
if (!moduleSpecifier) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
14
23
|
return moduleSpecifier.startsWith('@blocklet/pages-kit/builtin/') || isRelativeModule(moduleSpecifier);
|
|
15
24
|
};
|
|
16
25
|
// filter and collect the import statements that need to be processed
|