@sdk-usage/core 0.0.0-next-eab563c → 0.0.0-next-be2a154
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/dist/index.cjs +6 -6
- package/dist/index.d.ts +9 -17
- package/dist/index.mjs +5 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -123,7 +123,7 @@ const parse = async (code, { onAdd, plugins })=>{
|
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
|
-
for (const plugin of plugins
|
|
126
|
+
for (const plugin of plugins){
|
|
127
127
|
const pluginOutput = plugin(context, {
|
|
128
128
|
getJSXAttributeValue
|
|
129
129
|
});
|
|
@@ -224,7 +224,7 @@ const createLocation = ({ code, file, link, module, offset, path })=>{
|
|
|
224
224
|
return item;
|
|
225
225
|
};
|
|
226
226
|
|
|
227
|
-
const
|
|
227
|
+
const createInstance = (path, options)=>{
|
|
228
228
|
return {
|
|
229
229
|
async getItems () {
|
|
230
230
|
const projects = await scan(path);
|
|
@@ -269,7 +269,7 @@ const createContext = (path, options)=>{
|
|
|
269
269
|
version
|
|
270
270
|
}));
|
|
271
271
|
},
|
|
272
|
-
plugins: options.plugins
|
|
272
|
+
plugins: options.plugins ?? []
|
|
273
273
|
});
|
|
274
274
|
}
|
|
275
275
|
}
|
|
@@ -278,9 +278,9 @@ const createContext = (path, options)=>{
|
|
|
278
278
|
};
|
|
279
279
|
};
|
|
280
280
|
|
|
281
|
-
const
|
|
281
|
+
const createPlugin = (input)=>{
|
|
282
282
|
return input;
|
|
283
283
|
};
|
|
284
284
|
|
|
285
|
-
exports.
|
|
286
|
-
exports.
|
|
285
|
+
exports.createInstance = createInstance;
|
|
286
|
+
exports.createPlugin = createPlugin;
|
package/dist/index.d.ts
CHANGED
|
@@ -65,8 +65,8 @@ type ItemDTO = Partial<Pick<Item, "input">> & Pick<Item, "module" | "name" | "ty
|
|
|
65
65
|
offset: number;
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
declare const
|
|
69
|
-
type
|
|
68
|
+
declare const createPlugin: (input: Plugin) => Plugin;
|
|
69
|
+
type Plugin = (context: {
|
|
70
70
|
imports: Map<Import["alias"], Import>;
|
|
71
71
|
}, helpers: {
|
|
72
72
|
getJSXAttributeValue: (node: Nodes["JSXAttrValue"] | undefined) => Primitive;
|
|
@@ -74,31 +74,23 @@ type SyntaxPlugin = (context: {
|
|
|
74
74
|
[Key in keyof Nodes]?: (node: Nodes[Key]) => ItemDTO | undefined;
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
type Plugins = {
|
|
78
|
-
syntax: SyntaxPlugin[];
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
type ParseOptions = {
|
|
82
|
-
onAdd: (item: ItemDTO) => void;
|
|
83
|
-
/**
|
|
84
|
-
* A list of plugins to enable.
|
|
85
|
-
*/
|
|
86
|
-
plugins: Plugins;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
77
|
type Options = Partial<Pick<ScanOptions, "excludeFolders" | "includeFiles"> & {
|
|
90
78
|
/**
|
|
91
79
|
* Only analyze components imported from the specificied module list.
|
|
92
80
|
*/
|
|
93
81
|
includeModules: string[];
|
|
82
|
+
/**
|
|
83
|
+
* A list of plugins to enable.
|
|
84
|
+
*/
|
|
85
|
+
plugins: Plugin[];
|
|
94
86
|
/**
|
|
95
87
|
* Attempt to resolve installed versions of modules. If false or not possible, the specified version from the package.json will be used.
|
|
96
88
|
* @default false
|
|
97
89
|
*/
|
|
98
90
|
resolveInstalledVersions: boolean;
|
|
99
|
-
}
|
|
100
|
-
declare const
|
|
91
|
+
}>;
|
|
92
|
+
declare const createInstance: (path: string, options: Options) => {
|
|
101
93
|
getItems(): Promise<Item[]>;
|
|
102
94
|
};
|
|
103
95
|
|
|
104
|
-
export {
|
|
96
|
+
export { createInstance, createPlugin };
|
package/dist/index.mjs
CHANGED
|
@@ -120,7 +120,7 @@ const parse = async (code, { onAdd, plugins })=>{
|
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
-
for (const plugin of plugins
|
|
123
|
+
for (const plugin of plugins){
|
|
124
124
|
const pluginOutput = plugin(context, {
|
|
125
125
|
getJSXAttributeValue
|
|
126
126
|
});
|
|
@@ -221,7 +221,7 @@ const createLocation = ({ code, file, link, module, offset, path })=>{
|
|
|
221
221
|
return item;
|
|
222
222
|
};
|
|
223
223
|
|
|
224
|
-
const
|
|
224
|
+
const createInstance = (path, options)=>{
|
|
225
225
|
return {
|
|
226
226
|
async getItems () {
|
|
227
227
|
const projects = await scan(path);
|
|
@@ -266,7 +266,7 @@ const createContext = (path, options)=>{
|
|
|
266
266
|
version
|
|
267
267
|
}));
|
|
268
268
|
},
|
|
269
|
-
plugins: options.plugins
|
|
269
|
+
plugins: options.plugins ?? []
|
|
270
270
|
});
|
|
271
271
|
}
|
|
272
272
|
}
|
|
@@ -275,8 +275,8 @@ const createContext = (path, options)=>{
|
|
|
275
275
|
};
|
|
276
276
|
};
|
|
277
277
|
|
|
278
|
-
const
|
|
278
|
+
const createPlugin = (input)=>{
|
|
279
279
|
return input;
|
|
280
280
|
};
|
|
281
281
|
|
|
282
|
-
export {
|
|
282
|
+
export { createInstance, createPlugin };
|