vue-component-meta 1.0.14 → 1.0.17

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/out/index.js CHANGED
@@ -95,7 +95,7 @@ function baseCreate(_host, checkerOptions, globalComponentName, ts) {
95
95
  },
96
96
  });
97
97
  const vueLanguageModule = vue.createLanguageModule(host.getTypeScriptModule(), host.getCurrentDirectory(), host.getCompilationSettings(), host.getVueCompilationSettings());
98
- const core = embedded.createEmbeddedLanguageServiceHost(host, [vueLanguageModule]);
98
+ const core = embedded.createLanguageContext(host, [vueLanguageModule]);
99
99
  const proxyApis = checkerOptions.forceUseTs ? {
100
100
  getScriptKind: (fileName) => {
101
101
  if (fileName.endsWith('.vue.js')) {
@@ -104,10 +104,10 @@ function baseCreate(_host, checkerOptions, globalComponentName, ts) {
104
104
  if (fileName.endsWith('.vue.jsx')) {
105
105
  return ts.ScriptKind.TSX;
106
106
  }
107
- return core.typescriptLanguageServiceHost.getScriptKind(fileName);
107
+ return core.typescript.languageServiceHost.getScriptKind(fileName);
108
108
  },
109
109
  } : {};
110
- const proxyHost = new Proxy(core.typescriptLanguageServiceHost, {
110
+ const proxyHost = new Proxy(core.typescript.languageServiceHost, {
111
111
  get(target, propKey) {
112
112
  if (propKey in proxyApis) {
113
113
  return proxyApis[propKey];
@@ -181,9 +181,9 @@ function baseCreate(_host, checkerOptions, globalComponentName, ts) {
181
181
  // fill defaults
182
182
  const printer = ts.createPrinter(checkerOptions.printer);
183
183
  const snapshot = host.getScriptSnapshot(componentPath);
184
- const vueSourceFile = (_a = core.mapper.get(componentPath)) === null || _a === void 0 ? void 0 : _a[0];
184
+ const vueSourceFile = (_a = core.virtualFiles.get(componentPath)) === null || _a === void 0 ? void 0 : _a[1];
185
185
  const vueDefaults = vueSourceFile && exportName === 'default'
186
- ? (vueSourceFile instanceof vue.VueSourceFile ? readVueComponentDefaultProps(vueSourceFile, printer, ts) : {})
186
+ ? (vueSourceFile instanceof vue.VueFile ? readVueComponentDefaultProps(vueSourceFile, printer, ts) : {})
187
187
  : {};
188
188
  const tsDefaults = !vueSourceFile ? readTsComponentDefaultProps(componentPath.substring(componentPath.lastIndexOf('.') + 1), // ts | js | tsx | jsx
189
189
  snapshot.getText(0, snapshot.getLength()), exportName, printer, ts) : {};
@@ -276,14 +276,24 @@ function createSchemaResolvers(typeChecker, symbolNode, { rawType, schema: optio
276
276
  const enabled = !!options;
277
277
  const ignore = typeof options === 'object' ? [...(_a = options === null || options === void 0 ? void 0 : options.ignore) !== null && _a !== void 0 ? _a : []] : [];
278
278
  function shouldIgnore(subtype) {
279
- const type = typeChecker.typeToString(subtype);
280
- if (type === 'any') {
279
+ const name = typeChecker.typeToString(subtype);
280
+ if (name === 'any') {
281
281
  return true;
282
282
  }
283
283
  if (ignore.length === 0) {
284
284
  return false;
285
285
  }
286
- return ignore.includes(type);
286
+ for (const item of ignore) {
287
+ if (typeof item === 'function') {
288
+ const result = item(name, subtype, typeChecker);
289
+ if (result != null)
290
+ return result;
291
+ }
292
+ else if (name === item) {
293
+ return true;
294
+ }
295
+ }
296
+ return false;
287
297
  }
288
298
  function setVisited(subtype) {
289
299
  const type = typeChecker.typeToString(subtype);
package/out/types.d.ts CHANGED
@@ -58,7 +58,11 @@ export type PropertyMetaSchema = string | {
58
58
  schema?: Record<string, PropertyMeta>;
59
59
  };
60
60
  export type MetaCheckerSchemaOptions = boolean | {
61
- ignore?: string[];
61
+ /**
62
+ * A list of type names to be ignored in expending in schema.
63
+ * Can be functions to ignore types dynamically.
64
+ */
65
+ ignore?: (string | ((name: string, type: ts.Type, typeChecker: ts.TypeChecker) => boolean | void | undefined | null))[];
62
66
  };
63
67
  export interface MetaCheckerOptions {
64
68
  schema?: MetaCheckerSchemaOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-component-meta",
3
- "version": "1.0.14",
3
+ "version": "1.0.17",
4
4
  "main": "out/index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -13,12 +13,12 @@
13
13
  "directory": "vue-language-tools/vue-component-meta"
14
14
  },
15
15
  "dependencies": {
16
- "@volar/language-core": "1.0.14",
17
- "@volar/vue-language-core": "1.0.14",
16
+ "@volar/language-core": "1.0.17",
17
+ "@volar/vue-language-core": "1.0.17",
18
18
  "typesafe-path": "^0.2.2"
19
19
  },
20
20
  "peerDependencies": {
21
21
  "typescript": "*"
22
22
  },
23
- "gitHead": "ce4d48b37db784400e15fe08282edc836e24d4cd"
23
+ "gitHead": "b66b64f579b5cafee9b8d70aa9f9303f39b6df49"
24
24
  }