detective-vue2 2.0.1 → 2.0.3
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/README.md +1 -0
- package/index.js +12 -10
- package/package.json +2 -2
package/README.md
CHANGED
package/index.js
CHANGED
|
@@ -10,20 +10,22 @@ const detectiveSass = require('detective-sass');
|
|
|
10
10
|
/**
|
|
11
11
|
* Extracts the dependencies of the supplied Vue module
|
|
12
12
|
*/
|
|
13
|
-
module.exports = function(
|
|
14
|
-
if (
|
|
15
|
-
if (typeof
|
|
13
|
+
module.exports = function(content, options) {
|
|
14
|
+
if (content === undefined) throw new Error('content not given');
|
|
15
|
+
if (typeof content !== 'string') throw new Error('content is not a string');
|
|
16
16
|
|
|
17
|
-
const result = compiler.parse(
|
|
18
|
-
const { styles, script } = result.descriptor;
|
|
17
|
+
const result = compiler.parse(content, { sourceMap: false });
|
|
18
|
+
const { styles, script, scriptSetup } = result.descriptor;
|
|
19
19
|
|
|
20
20
|
const dependencies = [];
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
for (const usedScript of [script, scriptSetup]) {
|
|
23
|
+
if (usedScript?.content) {
|
|
24
|
+
if (usedScript.attrs?.lang === 'ts') {
|
|
25
|
+
dependencies.push(...detectiveTypeScript(usedScript.content, options));
|
|
26
|
+
} else {
|
|
27
|
+
dependencies.push(...detectiveEs6(usedScript.content, options));
|
|
28
|
+
}
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "detective-vue2",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"author": "Havunen <sampo.kivisto@live.fi>",
|
|
5
5
|
"description": "Get the dependencies of a Vue module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"typescript": "^5.4.4"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@vue/compiler-sfc": "^3.4.
|
|
42
|
+
"@vue/compiler-sfc": "^3.4.27",
|
|
43
43
|
"detective-es6": "^5.0.0",
|
|
44
44
|
"detective-sass": "^6.0.0",
|
|
45
45
|
"detective-scss": "^5.0.0",
|