@una-ui/extractor-vue-script 1.0.0-alpha.10 → 1.0.0-alpha.12

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.
Files changed (2) hide show
  1. package/dist/index.mjs +13 -5
  2. package/package.json +6 -6
package/dist/index.mjs CHANGED
@@ -83,10 +83,14 @@ function discoverVariants(node, prefixes) {
83
83
  });
84
84
  }
85
85
  function parseCodeAst(code, id) {
86
- const { $ast: node } = parseModule(code, {
87
- sourceFileName: id
88
- });
89
- return node;
86
+ try {
87
+ const { $ast: node } = parseModule(code, {
88
+ sourceFileName: id
89
+ });
90
+ return node;
91
+ } catch (e) {
92
+ throw new SyntaxError(`Failed to parse code ast${id ? ` (file: ${id})` : ""}`, { cause: e });
93
+ }
90
94
  }
91
95
  function extractTemplateExpressions(node) {
92
96
  const expressions = [];
@@ -106,13 +110,17 @@ function extractTemplateExpressions(node) {
106
110
  });
107
111
  return expressions;
108
112
  }
113
+ const SUPPORTED_EXTENSION_IDS = /\.(?:[mc]?[jt]sx?|vue)$/;
109
114
  function extractorVueScript(options) {
110
115
  return {
111
116
  name: "@una-ui/extractor-vue-script",
112
117
  order: 0,
113
118
  async extract({ code, id }) {
114
- const astExprs = [];
115
119
  const cleanPath = parsePath(id).pathname;
120
+ if (!SUPPORTED_EXTENSION_IDS.test(cleanPath)) {
121
+ return void 0;
122
+ }
123
+ const astExprs = [];
116
124
  if (cleanPath.endsWith(".vue")) {
117
125
  const sfc = parse(code, {
118
126
  filename: cleanPath
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@una-ui/extractor-vue-script",
3
- "version": "1.0.0-alpha.10",
3
+ "version": "1.0.0-alpha.12",
4
4
  "description": "Unocss extractor for Vue script",
5
5
  "author": "Phojie Rengel <phojrengel@gmail.com>",
6
6
  "license": "MIT",
@@ -35,14 +35,14 @@
35
35
  "access": "public"
36
36
  },
37
37
  "dependencies": {
38
- "@babel/types": "^7.28.4",
39
- "@vue/compiler-core": "^3.5.22",
40
- "@vue/compiler-sfc": "^3.5.22",
41
- "magicast": "^0.3.5",
38
+ "@babel/types": "^7.28.5",
39
+ "@vue/compiler-core": "^3.5.24",
40
+ "@vue/compiler-sfc": "^3.5.24",
41
+ "magicast": "^0.5.1",
42
42
  "ufo": "^1.6.1"
43
43
  },
44
44
  "devDependencies": {
45
- "@unocss/core": "^66.5.1",
45
+ "@unocss/core": "^66.5.4",
46
46
  "vitest": "^3.2.4"
47
47
  },
48
48
  "scripts": {