@uni_toolkit/shared 0.0.14 → 0.0.15-alpha.1764125154422
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 +24 -2
- package/dist/index.d.cts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +22 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -32,7 +32,8 @@ var src_exports = {};
|
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
getOutputJsonPath: () => getOutputJsonPath,
|
|
34
34
|
isMiniProgram: () => isMiniProgram,
|
|
35
|
-
isString: () => isString
|
|
35
|
+
isString: () => isString,
|
|
36
|
+
parseVueRequest: () => parseVueRequest
|
|
36
37
|
});
|
|
37
38
|
module.exports = __toCommonJS(src_exports);
|
|
38
39
|
var import_node_path = __toESM(require("path"), 1);
|
|
@@ -47,9 +48,30 @@ function isMiniProgram() {
|
|
|
47
48
|
function isString(value) {
|
|
48
49
|
return typeof value === "string";
|
|
49
50
|
}
|
|
51
|
+
function parseVueRequest(id) {
|
|
52
|
+
const [filename, rawQuery] = id.split(`?`, 2);
|
|
53
|
+
const query = Object.fromEntries(new URLSearchParams(rawQuery));
|
|
54
|
+
if (query.vue != null) {
|
|
55
|
+
query.vue = true;
|
|
56
|
+
}
|
|
57
|
+
if (query.src != null) {
|
|
58
|
+
query.src = true;
|
|
59
|
+
}
|
|
60
|
+
if (query.index != null) {
|
|
61
|
+
query.index = Number(query.index);
|
|
62
|
+
}
|
|
63
|
+
if (query.raw != null) {
|
|
64
|
+
query.raw = true;
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
filename,
|
|
68
|
+
query
|
|
69
|
+
};
|
|
70
|
+
}
|
|
50
71
|
// Annotate the CommonJS export names for ESM import in node:
|
|
51
72
|
0 && (module.exports = {
|
|
52
73
|
getOutputJsonPath,
|
|
53
74
|
isMiniProgram,
|
|
54
|
-
isString
|
|
75
|
+
isString,
|
|
76
|
+
parseVueRequest
|
|
55
77
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
declare function getOutputJsonPath(filePath: string): string;
|
|
2
2
|
declare function isMiniProgram(): boolean | undefined;
|
|
3
3
|
declare function isString(value: unknown): value is string;
|
|
4
|
+
interface VueQuery {
|
|
5
|
+
vue?: boolean;
|
|
6
|
+
src?: boolean;
|
|
7
|
+
type?: 'script' | 'template' | 'style' | 'custom' | 'page';
|
|
8
|
+
index?: number;
|
|
9
|
+
lang?: string;
|
|
10
|
+
raw?: boolean;
|
|
11
|
+
setup?: boolean;
|
|
12
|
+
'lang.ts'?: string;
|
|
13
|
+
'lang.js'?: string;
|
|
14
|
+
}
|
|
15
|
+
declare function parseVueRequest(id: string): {
|
|
16
|
+
filename: string;
|
|
17
|
+
query: VueQuery;
|
|
18
|
+
};
|
|
4
19
|
|
|
5
|
-
export { getOutputJsonPath, isMiniProgram, isString };
|
|
20
|
+
export { VueQuery, getOutputJsonPath, isMiniProgram, isString, parseVueRequest };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
declare function getOutputJsonPath(filePath: string): string;
|
|
2
2
|
declare function isMiniProgram(): boolean | undefined;
|
|
3
3
|
declare function isString(value: unknown): value is string;
|
|
4
|
+
interface VueQuery {
|
|
5
|
+
vue?: boolean;
|
|
6
|
+
src?: boolean;
|
|
7
|
+
type?: 'script' | 'template' | 'style' | 'custom' | 'page';
|
|
8
|
+
index?: number;
|
|
9
|
+
lang?: string;
|
|
10
|
+
raw?: boolean;
|
|
11
|
+
setup?: boolean;
|
|
12
|
+
'lang.ts'?: string;
|
|
13
|
+
'lang.js'?: string;
|
|
14
|
+
}
|
|
15
|
+
declare function parseVueRequest(id: string): {
|
|
16
|
+
filename: string;
|
|
17
|
+
query: VueQuery;
|
|
18
|
+
};
|
|
4
19
|
|
|
5
|
-
export { getOutputJsonPath, isMiniProgram, isString };
|
|
20
|
+
export { VueQuery, getOutputJsonPath, isMiniProgram, isString, parseVueRequest };
|
package/dist/index.js
CHANGED
|
@@ -11,8 +11,29 @@ function isMiniProgram() {
|
|
|
11
11
|
function isString(value) {
|
|
12
12
|
return typeof value === "string";
|
|
13
13
|
}
|
|
14
|
+
function parseVueRequest(id) {
|
|
15
|
+
const [filename, rawQuery] = id.split(`?`, 2);
|
|
16
|
+
const query = Object.fromEntries(new URLSearchParams(rawQuery));
|
|
17
|
+
if (query.vue != null) {
|
|
18
|
+
query.vue = true;
|
|
19
|
+
}
|
|
20
|
+
if (query.src != null) {
|
|
21
|
+
query.src = true;
|
|
22
|
+
}
|
|
23
|
+
if (query.index != null) {
|
|
24
|
+
query.index = Number(query.index);
|
|
25
|
+
}
|
|
26
|
+
if (query.raw != null) {
|
|
27
|
+
query.raw = true;
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
filename,
|
|
31
|
+
query
|
|
32
|
+
};
|
|
33
|
+
}
|
|
14
34
|
export {
|
|
15
35
|
getOutputJsonPath,
|
|
16
36
|
isMiniProgram,
|
|
17
|
-
isString
|
|
37
|
+
isString,
|
|
38
|
+
parseVueRequest
|
|
18
39
|
};
|