@uni_toolkit/shared 0.0.20 → 0.0.21-alpha.1776525034225

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 CHANGED
@@ -1,77 +1,50 @@
1
- "use strict";
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
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
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
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
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
- const relativePath = import_node_path.default.relative(process.env.UNI_INPUT_DIR, filePath);
42
- const { name, dir } = import_node_path.default.parse(relativePath);
43
- return import_node_path.default.join(process.env.UNI_OUTPUT_DIR, dir, `${name}.json`);
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
- return !!process.env.UNI_PLATFORM?.startsWith("mp-");
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
- 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
- };
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
- // Annotate the CommonJS export names for ESM import in node:
72
- 0 && (module.exports = {
73
- getOutputJsonPath,
74
- isMiniProgram,
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
- 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;
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
- filename: string;
17
- query: VueQuery;
16
+ filename: string;
17
+ query: VueQuery;
18
18
  };
19
-
20
- export { VueQuery, getOutputJsonPath, isMiniProgram, isString, parseVueRequest };
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
- 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;
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
- filename: string;
17
- query: VueQuery;
16
+ filename: string;
17
+ query: VueQuery;
18
18
  };
19
-
20
- export { VueQuery, getOutputJsonPath, isMiniProgram, isString, parseVueRequest };
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
- 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`);
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
- return !!process.env.UNI_PLATFORM?.startsWith("mp-");
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
- 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
- };
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
- export {
35
- getOutputJsonPath,
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.20",
3
+ "version": "0.0.21-alpha.1776525034225",
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
- "tsup": "7.2.0",
25
+ "tsdown": "^0.21.8",
26
26
  "@types/node": "^18.7.20"
27
27
  },
28
28
  "scripts": {
29
- "build": "tsup src/index.ts --format esm,cjs --out-dir=dist --dts --clean",
30
- "dev": "tsup src/index.ts --format esm --out-dir=dist --watch --dts"
29
+ "build": "tsdown",
30
+ "dev": "tsdown --watch"
31
31
  }
32
32
  }