@hanzogui/vite-plugin 4.3.1 → 7.0.0
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/cjs/index.cjs +13 -20
- package/dist/esm/index.mjs +7 -2
- package/dist/types/index.d.ts +10 -0
- package/package.json +12 -45
- package/LICENSE +0 -21
- package/dist/cjs/extensions.cjs +0 -28
- package/dist/cjs/loadGui.cjs +0 -101
- package/dist/cjs/plugin.cjs +0 -431
- package/dist/esm/extensions.mjs +0 -3
- package/dist/esm/extensions.mjs.map +0 -1
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/loadGui.mjs +0 -61
- package/dist/esm/loadGui.mjs.map +0 -1
- package/dist/esm/plugin.mjs +0 -393
- package/dist/esm/plugin.mjs.map +0 -1
- package/src/extensions.ts +0 -12
- package/src/index.ts +0 -1
- package/src/loadGui.ts +0 -94
- package/src/plugin.ts +0 -559
- package/types/extensions.d.ts +0 -2
- package/types/extensions.d.ts.map +0 -1
- package/types/index.d.ts +0 -2
- package/types/index.d.ts.map +0 -1
- package/types/loadGui.d.ts +0 -15
- package/types/loadGui.d.ts.map +0 -1
- package/types/plugin.d.ts +0 -22
- package/types/plugin.d.ts.map +0 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
16
|
-
value: true
|
|
17
|
-
}), mod);
|
|
18
|
-
var index_exports = {};
|
|
19
|
-
module.exports = __toCommonJS(index_exports);
|
|
20
|
-
__reExport(index_exports, require("./plugin.cjs"), module.exports);
|
|
1
|
+
'use strict';
|
|
2
|
+
function guiPlugin(opts) {
|
|
3
|
+
if (!opts) opts = {};
|
|
4
|
+
return {
|
|
5
|
+
name: '@hanzogui/vite-plugin',
|
|
6
|
+
enforce: 'pre',
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
exports.guiPlugin = guiPlugin;
|
|
10
|
+
exports.default = guiPlugin;
|
|
11
|
+
module.exports = guiPlugin;
|
|
12
|
+
module.exports.guiPlugin = guiPlugin;
|
|
13
|
+
module.exports.default = guiPlugin;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
export interface GuiPluginOptions {
|
|
3
|
+
config?: string;
|
|
4
|
+
components?: string[];
|
|
5
|
+
optimize?: boolean;
|
|
6
|
+
importsWhitelist?: string[];
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
export declare function guiPlugin(opts?: GuiPluginOptions): Plugin;
|
|
10
|
+
export default guiPlugin;
|
package/package.json
CHANGED
|
@@ -1,56 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzogui/vite-plugin",
|
|
3
|
-
"version": "
|
|
4
|
-
"license": "MIT",
|
|
5
|
-
"files": [
|
|
6
|
-
"src",
|
|
7
|
-
"types",
|
|
8
|
-
"dist"
|
|
9
|
-
],
|
|
3
|
+
"version": "7.0.0",
|
|
10
4
|
"type": "module",
|
|
11
|
-
"main": "dist/cjs",
|
|
12
|
-
"module": "dist/esm",
|
|
13
|
-
"types": "./types/index.d.ts",
|
|
5
|
+
"main": "./dist/cjs/index.cjs",
|
|
6
|
+
"module": "./dist/esm/index.mjs",
|
|
14
7
|
"exports": {
|
|
15
|
-
"./package.json": "./package.json",
|
|
16
8
|
".": {
|
|
17
|
-
"types": "./types/index.d.ts",
|
|
18
|
-
"browser": "./dist/esm/index.mjs",
|
|
19
|
-
"module": "./dist/esm/index.mjs",
|
|
9
|
+
"types": "./dist/types/index.d.ts",
|
|
20
10
|
"import": "./dist/esm/index.mjs",
|
|
21
|
-
"require": "./dist/cjs/index.cjs"
|
|
22
|
-
|
|
23
|
-
|
|
11
|
+
"require": "./dist/cjs/index.cjs"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
24
14
|
},
|
|
15
|
+
"types": "./dist/types/index.d.ts",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
25
19
|
"publishConfig": {
|
|
26
20
|
"access": "public"
|
|
27
21
|
},
|
|
28
|
-
"
|
|
29
|
-
"build": "hanzo-gui-build --skip-native",
|
|
30
|
-
"watch": "hanzo-gui-build --skip-native --watch",
|
|
31
|
-
"clean": "hanzo-gui-build clean",
|
|
32
|
-
"clean:build": "hanzo-gui-build clean:build"
|
|
33
|
-
},
|
|
34
|
-
"dependencies": {
|
|
35
|
-
"@hanzogui/fake-react-native": "3.0.7",
|
|
36
|
-
"@hanzogui/proxy-worm": "3.0.6",
|
|
37
|
-
"@hanzogui/react-native-svg": "3.0.6",
|
|
38
|
-
"@hanzogui/react-native-web-lite": "3.0.6",
|
|
39
|
-
"@hanzogui/static-worker": "3.0.6",
|
|
40
|
-
"@hanzogui/types": "3.0.6",
|
|
41
|
-
"esm-resolve": "^1.0.8",
|
|
42
|
-
"fs-extra": "^11.2.0",
|
|
43
|
-
"outdent": "^0.8.0",
|
|
44
|
-
"react-native-web": "^0.21.0"
|
|
45
|
-
},
|
|
46
|
-
"devDependencies": {
|
|
47
|
-
"@hanzogui/build": "3.0.6",
|
|
48
|
-
"vite": "^8.0.0"
|
|
49
|
-
},
|
|
50
|
-
"peerDependencies": {
|
|
51
|
-
"vite": "*"
|
|
52
|
-
},
|
|
53
|
-
"hanzo-gui-build": {
|
|
54
|
-
"skipEnvToMeta": true
|
|
55
|
-
}
|
|
22
|
+
"license": "MIT"
|
|
56
23
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020 Nate Wienert
|
|
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/cjs/extensions.cjs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all) __defProp(target, name, {
|
|
7
|
-
get: all[name],
|
|
8
|
-
enumerable: true
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
-
get: () => from[key],
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
-
value: true
|
|
22
|
-
}), mod);
|
|
23
|
-
var extensions_exports = {};
|
|
24
|
-
__export(extensions_exports, {
|
|
25
|
-
extensions: () => extensions
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(extensions_exports);
|
|
28
|
-
const extensions = [".ios.js", ".native.js", ".native.ts", ".native.tsx", ".js", ".jsx", ".json", ".ts", ".tsx", ".mjs"];
|
package/dist/cjs/loadGui.cjs
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all) __defProp(target, name, {
|
|
9
|
-
get: all[name],
|
|
10
|
-
enumerable: true
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
-
get: () => from[key],
|
|
17
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
-
value: mod,
|
|
29
|
-
enumerable: true
|
|
30
|
-
}) : target, mod));
|
|
31
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
-
value: true
|
|
33
|
-
}), mod);
|
|
34
|
-
var loadGui_exports = {};
|
|
35
|
-
__export(loadGui_exports, {
|
|
36
|
-
cleanup: () => cleanup,
|
|
37
|
-
ensureFullConfigLoaded: () => ensureFullConfigLoaded,
|
|
38
|
-
getGuiOptions: () => getGuiOptions,
|
|
39
|
-
getLoadPromise: () => getLoadPromise,
|
|
40
|
-
loadGuiBuildConfig: () => loadGuiBuildConfig
|
|
41
|
-
});
|
|
42
|
-
module.exports = __toCommonJS(loadGui_exports);
|
|
43
|
-
var StaticWorker = __toESM(require("@hanzogui/static-worker"), 1);
|
|
44
|
-
const LOAD_STATE_KEY = "__gui_load_state__";
|
|
45
|
-
function getLoadState() {
|
|
46
|
-
if (!globalThis[LOAD_STATE_KEY]) {
|
|
47
|
-
;
|
|
48
|
-
globalThis[LOAD_STATE_KEY] = {
|
|
49
|
-
loadPromise: null,
|
|
50
|
-
loadedOptions: null,
|
|
51
|
-
fullConfigLoaded: false,
|
|
52
|
-
fullConfigLoadPromise: null
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
return globalThis[LOAD_STATE_KEY];
|
|
56
|
-
}
|
|
57
|
-
function getGuiOptions() {
|
|
58
|
-
return getLoadState().loadedOptions;
|
|
59
|
-
}
|
|
60
|
-
function getLoadPromise() {
|
|
61
|
-
return getLoadState().loadPromise;
|
|
62
|
-
}
|
|
63
|
-
async function loadGuiBuildConfig(optionsIn) {
|
|
64
|
-
const state = getLoadState();
|
|
65
|
-
if (state.loadedOptions) return state.loadedOptions;
|
|
66
|
-
if (state.loadPromise) return state.loadPromise;
|
|
67
|
-
state.loadPromise = (async () => {
|
|
68
|
-
const options = await StaticWorker.loadGuiBuildConfig({
|
|
69
|
-
...optionsIn,
|
|
70
|
-
platform: "web"
|
|
71
|
-
});
|
|
72
|
-
state.loadedOptions = options;
|
|
73
|
-
return options;
|
|
74
|
-
})();
|
|
75
|
-
return state.loadPromise;
|
|
76
|
-
}
|
|
77
|
-
async function ensureFullConfigLoaded() {
|
|
78
|
-
const state = getLoadState();
|
|
79
|
-
if (state.fullConfigLoaded) return;
|
|
80
|
-
if (state.fullConfigLoadPromise) return state.fullConfigLoadPromise;
|
|
81
|
-
state.fullConfigLoadPromise = (async () => {
|
|
82
|
-
const options = await loadGuiBuildConfig();
|
|
83
|
-
if (!options.disableWatchGuiConfig && !options.disable) {
|
|
84
|
-
await StaticWorker.loadGui({
|
|
85
|
-
components: ["@hanzo/gui"],
|
|
86
|
-
platform: "web",
|
|
87
|
-
...options
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
state.fullConfigLoaded = true;
|
|
91
|
-
})();
|
|
92
|
-
return state.fullConfigLoadPromise;
|
|
93
|
-
}
|
|
94
|
-
async function cleanup() {
|
|
95
|
-
await StaticWorker.destroyPool();
|
|
96
|
-
const state = getLoadState();
|
|
97
|
-
state.loadPromise = null;
|
|
98
|
-
state.loadedOptions = null;
|
|
99
|
-
state.fullConfigLoaded = false;
|
|
100
|
-
state.fullConfigLoadPromise = null;
|
|
101
|
-
}
|