@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 CHANGED
@@ -123,7 +123,7 @@ const parse = async (code, { onAdd, plugins })=>{
123
123
  });
124
124
  }
125
125
  };
126
- for (const plugin of plugins.syntax){
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 createContext = (path, options)=>{
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 createSyntaxPlugin = (input)=>{
281
+ const createPlugin = (input)=>{
282
282
  return input;
283
283
  };
284
284
 
285
- exports.createContext = createContext;
286
- exports.createSyntaxPlugin = createSyntaxPlugin;
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 createSyntaxPlugin: (input: SyntaxPlugin) => SyntaxPlugin;
69
- type SyntaxPlugin = (context: {
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
- }> & Pick<ParseOptions, "plugins">;
100
- declare const createContext: (path: string, options: Options) => {
91
+ }>;
92
+ declare const createInstance: (path: string, options: Options) => {
101
93
  getItems(): Promise<Item[]>;
102
94
  };
103
95
 
104
- export { createContext, createSyntaxPlugin };
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.syntax){
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 createContext = (path, options)=>{
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 createSyntaxPlugin = (input)=>{
278
+ const createPlugin = (input)=>{
279
279
  return input;
280
280
  };
281
281
 
282
- export { createContext, createSyntaxPlugin };
282
+ export { createInstance, createPlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdk-usage/core",
3
- "version": "0.0.0-next-eab563c",
3
+ "version": "0.0.0-next-be2a154",
4
4
  "description": "sdk-usage core functionalities",
5
5
  "keywords": [
6
6
  "analyze",