@uni_toolkit/shared 0.0.1-alpha.1760173856418

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 chouchouji
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.cjs ADDED
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ 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
+ 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;
19
+ };
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
+ });
37
+ module.exports = __toCommonJS(src_exports);
38
+ var import_path = __toESM(require("path"), 1);
39
+ function getOutputJsonPath(filePath) {
40
+ const relativePath = import_path.default.relative(process.env.UNI_INPUT_DIR, filePath);
41
+ const { name, dir } = import_path.default.parse(relativePath);
42
+ return import_path.default.join(process.env.UNI_OUTPUT_DIR, dir, name + ".json");
43
+ }
44
+ function isMiniProgram() {
45
+ return process.env.UNI_PLATFORM?.startsWith("mp-");
46
+ }
47
+ function isString(value) {
48
+ return typeof value === "string";
49
+ }
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ getOutputJsonPath,
53
+ isMiniProgram,
54
+ isString
55
+ });
@@ -0,0 +1,5 @@
1
+ declare function getOutputJsonPath(filePath: string): string;
2
+ declare function isMiniProgram(): boolean | undefined;
3
+ declare function isString(value: unknown): value is string;
4
+
5
+ export { getOutputJsonPath, isMiniProgram, isString };
@@ -0,0 +1,5 @@
1
+ declare function getOutputJsonPath(filePath: string): string;
2
+ declare function isMiniProgram(): boolean | undefined;
3
+ declare function isString(value: unknown): value is string;
4
+
5
+ export { getOutputJsonPath, isMiniProgram, isString };
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ // src/index.ts
2
+ import path from "path";
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");
7
+ }
8
+ function isMiniProgram() {
9
+ return process.env.UNI_PLATFORM?.startsWith("mp-");
10
+ }
11
+ function isString(value) {
12
+ return typeof value === "string";
13
+ }
14
+ export {
15
+ getOutputJsonPath,
16
+ isMiniProgram,
17
+ isString
18
+ };
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@uni_toolkit/shared",
3
+ "version": "0.0.1-alpha.1760173856418",
4
+ "license": "MIT",
5
+ "author": "chouchouji <1305974212@qq.com>",
6
+ "type": "module",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js",
11
+ "require": "./dist/index.cjs"
12
+ }
13
+ },
14
+ "main": "dist/index.cjs",
15
+ "module": "dist/index.js",
16
+ "types": "dist/index.d.ts",
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "devDependencies": {
21
+ "typescript": "5.3.3",
22
+ "tsup": "7.2.0",
23
+ "@types/node": "^18.7.20"
24
+ },
25
+ "scripts": {
26
+ "build": "tsup src/index.ts --format esm,cjs --out-dir=dist --dts --clean",
27
+ "dev": "tsup src/index.ts --format esm --out-dir=dist --watch --dts"
28
+ }
29
+ }