@heycar/heycars-map 0.9.7 → 0.9.8-fix2
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/bin/checkVersion.js +36 -0
- package/bin/checkVersion.ts +47 -0
- package/bin/tsconfig.json +9 -0
- package/dist/index.cjs +34 -2
- package/dist/index.js +34 -2
- package/dist/src/types/my.d.ts +21 -0
- package/dist/src/types/wx.d.ts +1 -0
- package/package.json +7 -1
- package/tsconfig.json +1 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { open } from "node:fs/promises";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import * as process from "node:process";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import * as semver from "semver";
|
|
7
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const libPackagePath = path.resolve(__dirname, "../package.json");
|
|
9
|
+
const projectPackagePath = path.resolve(process.cwd(), "package.json");
|
|
10
|
+
const readProjectPackage = async (packagePath) => {
|
|
11
|
+
let fileHandler;
|
|
12
|
+
try {
|
|
13
|
+
fileHandler = await open(packagePath);
|
|
14
|
+
} catch (err) {
|
|
15
|
+
if (err.code == "ENOENT") throw new Error("hint: 确保在项目根目录下运行");
|
|
16
|
+
else throw err;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const content = await fileHandler.readFile("utf-8");
|
|
20
|
+
return JSON.parse(content);
|
|
21
|
+
} finally {
|
|
22
|
+
fileHandler.close();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const checkVersion = async (projectPackagePath, libPackagePath) => {
|
|
26
|
+
const { dependencies } = await readProjectPackage(projectPackagePath);
|
|
27
|
+
const pkg = await readProjectPackage(libPackagePath);
|
|
28
|
+
const range = dependencies?.[pkg.name];
|
|
29
|
+
if (range.startsWith("file:///")) return;
|
|
30
|
+
if (!range) throw new Error(`hint: 在 package.json 的 dependencies 下面没有 ${pkg.name}`);
|
|
31
|
+
if (!semver.satisfies(pkg.version, range))
|
|
32
|
+
throw new Error(
|
|
33
|
+
`hint: ${pkg.name} 版本不匹配, 要求的版本是: ${range}, 实际安装的版本是 ${pkg.version}`,
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
checkVersion(projectPackagePath, libPackagePath);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { FileHandle, open } from "node:fs/promises";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
import * as process from "node:process";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
import * as semver from "semver";
|
|
8
|
+
|
|
9
|
+
interface Package {
|
|
10
|
+
name?: string;
|
|
11
|
+
version?: string;
|
|
12
|
+
dependencies?: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
const libPackagePath = path.resolve(__dirname, "../package.json");
|
|
17
|
+
const projectPackagePath = path.resolve(process.cwd(), "package.json");
|
|
18
|
+
|
|
19
|
+
const readProjectPackage = async (packagePath: string): Promise<Package> => {
|
|
20
|
+
let fileHandler: FileHandle;
|
|
21
|
+
try {
|
|
22
|
+
fileHandler = await open(packagePath);
|
|
23
|
+
} catch (err) {
|
|
24
|
+
if (err.code == "ENOENT") throw new Error("hint: 确保在项目根目录下运行");
|
|
25
|
+
else throw err;
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const content = await fileHandler.readFile("utf-8");
|
|
29
|
+
return JSON.parse(content);
|
|
30
|
+
} finally {
|
|
31
|
+
fileHandler.close();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const checkVersion = async (projectPackagePath: string, libPackagePath: string) => {
|
|
36
|
+
const { dependencies } = await readProjectPackage(projectPackagePath);
|
|
37
|
+
const pkg = await readProjectPackage(libPackagePath);
|
|
38
|
+
const range = dependencies?.[pkg.name];
|
|
39
|
+
if (range.startsWith("file:///")) return;
|
|
40
|
+
if (!range) throw new Error(`hint: 在 package.json 的 dependencies 下面没有 ${pkg.name}`);
|
|
41
|
+
if (!semver.satisfies(pkg.version, range))
|
|
42
|
+
throw new Error(
|
|
43
|
+
`hint: ${pkg.name} 版本不匹配, 要求的版本是: ${range}, 实际安装的版本是 ${pkg.version}`,
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
checkVersion(projectPackagePath, libPackagePath);
|
package/dist/index.cjs
CHANGED
|
@@ -9,12 +9,16 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
9
9
|
const Vue = require("vue");
|
|
10
10
|
const style_css_ts_vanilla = "";
|
|
11
11
|
const name = "@heycar/heycars-map";
|
|
12
|
-
const version = "0.9.
|
|
12
|
+
const version = "0.9.8-fix2";
|
|
13
13
|
const type = "module";
|
|
14
|
+
const bin = {
|
|
15
|
+
checkVersion: "./bin/checkVersion.js"
|
|
16
|
+
};
|
|
14
17
|
const scripts = {
|
|
15
18
|
dev: "vite -c vite.config.dev.ts",
|
|
16
19
|
"dev:lib": 'concurrently "vite build -c vite.config.dev.lib.ts --watch --emptyOutDir false" "tsc --declarationDir dist --emitDeclarationOnly --noEmit false --declaration --watch"',
|
|
17
20
|
build: "rm -rf dist && vite build && tsc --declarationDir dist --emitDeclarationOnly --noEmit false --declaration",
|
|
21
|
+
"build:bin": "tsc -p ./bin/tsconfig.json && chmod +x bin/*.js",
|
|
18
22
|
lint: "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore --report-unused-disable-directives --max-warnings 0"
|
|
19
23
|
};
|
|
20
24
|
const types = "./dist/index.d.ts";
|
|
@@ -53,6 +57,7 @@ const peerDependenciesMeta = {
|
|
|
53
57
|
const devDependencies = {
|
|
54
58
|
"@types/google.maps": "^3.52.0",
|
|
55
59
|
"@types/lodash-es": "^4.17.6",
|
|
60
|
+
"@types/semver": "^7.5.1",
|
|
56
61
|
"@typescript-eslint/eslint-plugin": "^5.52.0",
|
|
57
62
|
"@typescript-eslint/parser": "^5.52.0",
|
|
58
63
|
"@vanilla-extract/css": "^1.9.5",
|
|
@@ -71,6 +76,7 @@ const devDependencies = {
|
|
|
71
76
|
"eslint-plugin-prettier": "^4.2.1",
|
|
72
77
|
"eslint-plugin-vue": "^9.9.0",
|
|
73
78
|
prettier: "^2.8.4",
|
|
79
|
+
semver: "^7.5.4",
|
|
74
80
|
typescript: "^4.9.3",
|
|
75
81
|
"unplugin-vue-jsx": "^0.1.2",
|
|
76
82
|
vite: "^4.1.0",
|
|
@@ -90,6 +96,7 @@ const pkg = {
|
|
|
90
96
|
name,
|
|
91
97
|
version,
|
|
92
98
|
type,
|
|
99
|
+
bin,
|
|
93
100
|
scripts,
|
|
94
101
|
types,
|
|
95
102
|
module: module$1,
|
|
@@ -3824,7 +3831,11 @@ function wechatWatchPosition(onSuccess, onError, option) {
|
|
|
3824
3831
|
isHandled = true;
|
|
3825
3832
|
const isGeoWorking = isGeoWorkingRef.value;
|
|
3826
3833
|
isGeoWorkingRef.value = false;
|
|
3827
|
-
console.warn(
|
|
3834
|
+
console.warn(
|
|
3835
|
+
"MyWarning: wx.getLocation failed errcode, errmsg = ",
|
|
3836
|
+
res.errCode,
|
|
3837
|
+
res.errMsg
|
|
3838
|
+
);
|
|
3828
3839
|
resolve(void 0);
|
|
3829
3840
|
if (!isGeoWorking)
|
|
3830
3841
|
return;
|
|
@@ -3914,6 +3925,25 @@ function compatibleWathPosition(onSuccess, onError, option) {
|
|
|
3914
3925
|
const watchId = navigator.geolocation.watchPosition(onSuccess, onError, option);
|
|
3915
3926
|
return () => navigator.geolocation.clearWatch(watchId);
|
|
3916
3927
|
}
|
|
3928
|
+
window.efg = () => my.getLocation({
|
|
3929
|
+
type: 0,
|
|
3930
|
+
cacheTimeout: 1,
|
|
3931
|
+
success(res) {
|
|
3932
|
+
console.log("my.getLocation success = ", JSON.stringify(res, null, 2));
|
|
3933
|
+
},
|
|
3934
|
+
fail(res) {
|
|
3935
|
+
console.log("my.getLocation fail = ", JSON.stringify(res, null, 2));
|
|
3936
|
+
}
|
|
3937
|
+
});
|
|
3938
|
+
window.abc = () => wx.getLocation({
|
|
3939
|
+
type: "wgs84",
|
|
3940
|
+
success(res) {
|
|
3941
|
+
console.log("wx.getLocation success = ", JSON.stringify(res, null, 2));
|
|
3942
|
+
},
|
|
3943
|
+
fail(res) {
|
|
3944
|
+
console.log("wx.getLocation fail = ", JSON.stringify(res, null, 2));
|
|
3945
|
+
}
|
|
3946
|
+
});
|
|
3917
3947
|
class SingleGeoWatch {
|
|
3918
3948
|
constructor(option) {
|
|
3919
3949
|
__publicField(this, "id", 0);
|
|
@@ -5790,6 +5820,7 @@ const useAmapPlace = (props) => {
|
|
|
5790
5820
|
async () => {
|
|
5791
5821
|
await readyPromise;
|
|
5792
5822
|
const resultPlace = await getPlaceByRegeo(pointRef.value);
|
|
5823
|
+
Object.assign(place, resultPlace);
|
|
5793
5824
|
onChange == null ? void 0 : onChange(resultPlace);
|
|
5794
5825
|
}
|
|
5795
5826
|
);
|
|
@@ -5832,6 +5863,7 @@ const useGmapPlace = (props) => {
|
|
|
5832
5863
|
async () => {
|
|
5833
5864
|
await readyPromise;
|
|
5834
5865
|
const resultPlace = await getPlaceByRegeo(pointRef.value);
|
|
5866
|
+
Object.assign(place, resultPlace);
|
|
5835
5867
|
onChange == null ? void 0 : onChange(resultPlace);
|
|
5836
5868
|
}
|
|
5837
5869
|
);
|
package/dist/index.js
CHANGED
|
@@ -7,12 +7,16 @@ var __publicField = (obj, key, value) => {
|
|
|
7
7
|
import Vue, { defineComponent, h, computed, inject, provide, watch, onMounted, onUnmounted, watchPostEffect, shallowRef, ref, watchEffect, reactive, toRefs, toRef } from "vue";
|
|
8
8
|
const style_css_ts_vanilla = "";
|
|
9
9
|
const name = "@heycar/heycars-map";
|
|
10
|
-
const version = "0.9.
|
|
10
|
+
const version = "0.9.8-fix2";
|
|
11
11
|
const type = "module";
|
|
12
|
+
const bin = {
|
|
13
|
+
checkVersion: "./bin/checkVersion.js"
|
|
14
|
+
};
|
|
12
15
|
const scripts = {
|
|
13
16
|
dev: "vite -c vite.config.dev.ts",
|
|
14
17
|
"dev:lib": 'concurrently "vite build -c vite.config.dev.lib.ts --watch --emptyOutDir false" "tsc --declarationDir dist --emitDeclarationOnly --noEmit false --declaration --watch"',
|
|
15
18
|
build: "rm -rf dist && vite build && tsc --declarationDir dist --emitDeclarationOnly --noEmit false --declaration",
|
|
19
|
+
"build:bin": "tsc -p ./bin/tsconfig.json && chmod +x bin/*.js",
|
|
16
20
|
lint: "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore --report-unused-disable-directives --max-warnings 0"
|
|
17
21
|
};
|
|
18
22
|
const types = "./dist/index.d.ts";
|
|
@@ -51,6 +55,7 @@ const peerDependenciesMeta = {
|
|
|
51
55
|
const devDependencies = {
|
|
52
56
|
"@types/google.maps": "^3.52.0",
|
|
53
57
|
"@types/lodash-es": "^4.17.6",
|
|
58
|
+
"@types/semver": "^7.5.1",
|
|
54
59
|
"@typescript-eslint/eslint-plugin": "^5.52.0",
|
|
55
60
|
"@typescript-eslint/parser": "^5.52.0",
|
|
56
61
|
"@vanilla-extract/css": "^1.9.5",
|
|
@@ -69,6 +74,7 @@ const devDependencies = {
|
|
|
69
74
|
"eslint-plugin-prettier": "^4.2.1",
|
|
70
75
|
"eslint-plugin-vue": "^9.9.0",
|
|
71
76
|
prettier: "^2.8.4",
|
|
77
|
+
semver: "^7.5.4",
|
|
72
78
|
typescript: "^4.9.3",
|
|
73
79
|
"unplugin-vue-jsx": "^0.1.2",
|
|
74
80
|
vite: "^4.1.0",
|
|
@@ -88,6 +94,7 @@ const pkg = {
|
|
|
88
94
|
name,
|
|
89
95
|
version,
|
|
90
96
|
type,
|
|
97
|
+
bin,
|
|
91
98
|
scripts,
|
|
92
99
|
types,
|
|
93
100
|
module,
|
|
@@ -3822,7 +3829,11 @@ function wechatWatchPosition(onSuccess, onError, option) {
|
|
|
3822
3829
|
isHandled = true;
|
|
3823
3830
|
const isGeoWorking = isGeoWorkingRef.value;
|
|
3824
3831
|
isGeoWorkingRef.value = false;
|
|
3825
|
-
console.warn(
|
|
3832
|
+
console.warn(
|
|
3833
|
+
"MyWarning: wx.getLocation failed errcode, errmsg = ",
|
|
3834
|
+
res.errCode,
|
|
3835
|
+
res.errMsg
|
|
3836
|
+
);
|
|
3826
3837
|
resolve(void 0);
|
|
3827
3838
|
if (!isGeoWorking)
|
|
3828
3839
|
return;
|
|
@@ -3912,6 +3923,25 @@ function compatibleWathPosition(onSuccess, onError, option) {
|
|
|
3912
3923
|
const watchId = navigator.geolocation.watchPosition(onSuccess, onError, option);
|
|
3913
3924
|
return () => navigator.geolocation.clearWatch(watchId);
|
|
3914
3925
|
}
|
|
3926
|
+
window.efg = () => my.getLocation({
|
|
3927
|
+
type: 0,
|
|
3928
|
+
cacheTimeout: 1,
|
|
3929
|
+
success(res) {
|
|
3930
|
+
console.log("my.getLocation success = ", JSON.stringify(res, null, 2));
|
|
3931
|
+
},
|
|
3932
|
+
fail(res) {
|
|
3933
|
+
console.log("my.getLocation fail = ", JSON.stringify(res, null, 2));
|
|
3934
|
+
}
|
|
3935
|
+
});
|
|
3936
|
+
window.abc = () => wx.getLocation({
|
|
3937
|
+
type: "wgs84",
|
|
3938
|
+
success(res) {
|
|
3939
|
+
console.log("wx.getLocation success = ", JSON.stringify(res, null, 2));
|
|
3940
|
+
},
|
|
3941
|
+
fail(res) {
|
|
3942
|
+
console.log("wx.getLocation fail = ", JSON.stringify(res, null, 2));
|
|
3943
|
+
}
|
|
3944
|
+
});
|
|
3915
3945
|
class SingleGeoWatch {
|
|
3916
3946
|
constructor(option) {
|
|
3917
3947
|
__publicField(this, "id", 0);
|
|
@@ -5788,6 +5818,7 @@ const useAmapPlace = (props) => {
|
|
|
5788
5818
|
async () => {
|
|
5789
5819
|
await readyPromise;
|
|
5790
5820
|
const resultPlace = await getPlaceByRegeo(pointRef.value);
|
|
5821
|
+
Object.assign(place, resultPlace);
|
|
5791
5822
|
onChange == null ? void 0 : onChange(resultPlace);
|
|
5792
5823
|
}
|
|
5793
5824
|
);
|
|
@@ -5830,6 +5861,7 @@ const useGmapPlace = (props) => {
|
|
|
5830
5861
|
async () => {
|
|
5831
5862
|
await readyPromise;
|
|
5832
5863
|
const resultPlace = await getPlaceByRegeo(pointRef.value);
|
|
5864
|
+
Object.assign(place, resultPlace);
|
|
5833
5865
|
onChange == null ? void 0 : onChange(resultPlace);
|
|
5834
5866
|
}
|
|
5835
5867
|
);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
interface MyGetLocationSuccessResponse {
|
|
2
|
+
longitude: number;
|
|
3
|
+
latitude: number;
|
|
4
|
+
accuracy: number;
|
|
5
|
+
altitude: number;
|
|
6
|
+
}
|
|
7
|
+
interface MyErrorResponse {
|
|
8
|
+
error: number;
|
|
9
|
+
errorMessage: string;
|
|
10
|
+
}
|
|
11
|
+
interface MyGetLocationProps {
|
|
12
|
+
type: 0 | 1 | 2 | 3;
|
|
13
|
+
cacheTimeout: number;
|
|
14
|
+
success: (response: MyGetLocationSuccessResponse) => void;
|
|
15
|
+
fail?: (response: MyErrorResponse) => void;
|
|
16
|
+
complete?: () => void;
|
|
17
|
+
}
|
|
18
|
+
export interface My {
|
|
19
|
+
getLocation: (props: MyGetLocationProps) => void;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
package/dist/src/types/wx.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heycar/heycars-map",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.8-fix2",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"bin": {
|
|
6
|
+
"checkVersion": "./bin/checkVersion.js"
|
|
7
|
+
},
|
|
5
8
|
"scripts": {
|
|
6
9
|
"dev": "vite -c vite.config.dev.ts",
|
|
7
10
|
"dev:lib": "concurrently \"vite build -c vite.config.dev.lib.ts --watch --emptyOutDir false\" \"tsc --declarationDir dist --emitDeclarationOnly --noEmit false --declaration --watch\"",
|
|
8
11
|
"build": "rm -rf dist && vite build && tsc --declarationDir dist --emitDeclarationOnly --noEmit false --declaration",
|
|
12
|
+
"build:bin": "tsc -p ./bin/tsconfig.json && chmod +x bin/*.js",
|
|
9
13
|
"lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore --report-unused-disable-directives --max-warnings 0"
|
|
10
14
|
},
|
|
11
15
|
"types": "./dist/index.d.ts",
|
|
@@ -44,6 +48,7 @@
|
|
|
44
48
|
"devDependencies": {
|
|
45
49
|
"@types/google.maps": "^3.52.0",
|
|
46
50
|
"@types/lodash-es": "^4.17.6",
|
|
51
|
+
"@types/semver": "^7.5.1",
|
|
47
52
|
"@typescript-eslint/eslint-plugin": "^5.52.0",
|
|
48
53
|
"@typescript-eslint/parser": "^5.52.0",
|
|
49
54
|
"@vanilla-extract/css": "^1.9.5",
|
|
@@ -62,6 +67,7 @@
|
|
|
62
67
|
"eslint-plugin-prettier": "^4.2.1",
|
|
63
68
|
"eslint-plugin-vue": "^9.9.0",
|
|
64
69
|
"prettier": "^2.8.4",
|
|
70
|
+
"semver": "^7.5.4",
|
|
65
71
|
"typescript": "^4.9.3",
|
|
66
72
|
"unplugin-vue-jsx": "^0.1.2",
|
|
67
73
|
"vite": "^4.1.0",
|