@uni_toolkit/shared 0.0.19 → 0.0.21-alpha.1776521649215
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 +36 -63
- package/dist/index.d.cts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.js +17 -32
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1,77 +1,50 @@
|
|
|
1
|
-
"
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
9
|
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
19
18
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/index.ts
|
|
31
|
-
var src_exports = {};
|
|
32
|
-
__export(src_exports, {
|
|
33
|
-
getOutputJsonPath: () => getOutputJsonPath,
|
|
34
|
-
isMiniProgram: () => isMiniProgram,
|
|
35
|
-
isString: () => isString,
|
|
36
|
-
parseVueRequest: () => parseVueRequest
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(src_exports);
|
|
39
|
-
var import_node_path = __toESM(require("path"), 1);
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: true
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
//#endregion
|
|
24
|
+
let node_path = require("node:path");
|
|
25
|
+
node_path = __toESM(node_path, 1);
|
|
26
|
+
//#region src/index.ts
|
|
40
27
|
function getOutputJsonPath(filePath) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
28
|
+
const relativePath = node_path.default.relative(process.env.UNI_INPUT_DIR, filePath);
|
|
29
|
+
const { name, dir } = node_path.default.parse(relativePath);
|
|
30
|
+
return node_path.default.join(process.env.UNI_OUTPUT_DIR, dir, `${name}.json`);
|
|
44
31
|
}
|
|
45
32
|
function isMiniProgram() {
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
function isString(value) {
|
|
49
|
-
return typeof value === "string";
|
|
33
|
+
return !!process.env.UNI_PLATFORM?.startsWith("mp-");
|
|
50
34
|
}
|
|
51
35
|
function parseVueRequest(id) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
if (query.raw != null) {
|
|
64
|
-
query.raw = true;
|
|
65
|
-
}
|
|
66
|
-
return {
|
|
67
|
-
filename,
|
|
68
|
-
query
|
|
69
|
-
};
|
|
36
|
+
const [filename, rawQuery] = id.split(`?`, 2);
|
|
37
|
+
const query = Object.fromEntries(new URLSearchParams(rawQuery));
|
|
38
|
+
if (query.vue != null) query.vue = true;
|
|
39
|
+
if (query.src != null) query.src = true;
|
|
40
|
+
if (query.index != null) query.index = Number(query.index);
|
|
41
|
+
if (query.raw != null) query.raw = true;
|
|
42
|
+
return {
|
|
43
|
+
filename,
|
|
44
|
+
query
|
|
45
|
+
};
|
|
70
46
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
isString,
|
|
76
|
-
parseVueRequest
|
|
77
|
-
});
|
|
47
|
+
//#endregion
|
|
48
|
+
exports.getOutputJsonPath = getOutputJsonPath;
|
|
49
|
+
exports.isMiniProgram = isMiniProgram;
|
|
50
|
+
exports.parseVueRequest = parseVueRequest;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
+
//#region src/index.d.ts
|
|
1
2
|
declare function getOutputJsonPath(filePath: string): string;
|
|
2
3
|
declare function isMiniProgram(): boolean;
|
|
3
|
-
declare function isString(value: unknown): value is string;
|
|
4
4
|
interface VueQuery {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
14
|
}
|
|
15
15
|
declare function parseVueRequest(id: string): {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
filename: string;
|
|
17
|
+
query: VueQuery;
|
|
18
18
|
};
|
|
19
|
-
|
|
20
|
-
export { VueQuery, getOutputJsonPath, isMiniProgram,
|
|
19
|
+
//#endregion
|
|
20
|
+
export { VueQuery, getOutputJsonPath, isMiniProgram, parseVueRequest };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
+
//#region src/index.d.ts
|
|
1
2
|
declare function getOutputJsonPath(filePath: string): string;
|
|
2
3
|
declare function isMiniProgram(): boolean;
|
|
3
|
-
declare function isString(value: unknown): value is string;
|
|
4
4
|
interface VueQuery {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
14
|
}
|
|
15
15
|
declare function parseVueRequest(id: string): {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
filename: string;
|
|
17
|
+
query: VueQuery;
|
|
18
18
|
};
|
|
19
|
-
|
|
20
|
-
export { VueQuery, getOutputJsonPath, isMiniProgram,
|
|
19
|
+
//#endregion
|
|
20
|
+
export { VueQuery, getOutputJsonPath, isMiniProgram, parseVueRequest };
|
package/dist/index.js
CHANGED
|
@@ -1,39 +1,24 @@
|
|
|
1
|
-
// src/index.ts
|
|
2
1
|
import path from "node:path";
|
|
2
|
+
//#region src/index.ts
|
|
3
3
|
function getOutputJsonPath(filePath) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const relativePath = path.relative(process.env.UNI_INPUT_DIR, filePath);
|
|
5
|
+
const { name, dir } = path.parse(relativePath);
|
|
6
|
+
return path.join(process.env.UNI_OUTPUT_DIR, dir, `${name}.json`);
|
|
7
7
|
}
|
|
8
8
|
function isMiniProgram() {
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
function isString(value) {
|
|
12
|
-
return typeof value === "string";
|
|
9
|
+
return !!process.env.UNI_PLATFORM?.startsWith("mp-");
|
|
13
10
|
}
|
|
14
11
|
function parseVueRequest(id) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
if (query.raw != null) {
|
|
27
|
-
query.raw = true;
|
|
28
|
-
}
|
|
29
|
-
return {
|
|
30
|
-
filename,
|
|
31
|
-
query
|
|
32
|
-
};
|
|
12
|
+
const [filename, rawQuery] = id.split(`?`, 2);
|
|
13
|
+
const query = Object.fromEntries(new URLSearchParams(rawQuery));
|
|
14
|
+
if (query.vue != null) query.vue = true;
|
|
15
|
+
if (query.src != null) query.src = true;
|
|
16
|
+
if (query.index != null) query.index = Number(query.index);
|
|
17
|
+
if (query.raw != null) query.raw = true;
|
|
18
|
+
return {
|
|
19
|
+
filename,
|
|
20
|
+
query
|
|
21
|
+
};
|
|
33
22
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
isMiniProgram,
|
|
37
|
-
isString,
|
|
38
|
-
parseVueRequest
|
|
39
|
-
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { getOutputJsonPath, isMiniProgram, parseVueRequest };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uni_toolkit/shared",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21-alpha.1776521649215",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "chouchouji <1305974212@qq.com>",
|
|
6
6
|
"type": "module",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
],
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"typescript": "5.3.3",
|
|
25
|
-
"
|
|
25
|
+
"tsdown": "^0.21.8",
|
|
26
26
|
"@types/node": "^18.7.20"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
|
-
"build": "
|
|
30
|
-
"dev": "
|
|
29
|
+
"build": "tsdown",
|
|
30
|
+
"dev": "tsdown --watch"
|
|
31
31
|
}
|
|
32
32
|
}
|