@tamagui/vite-plugin 1.61.3 → 1.62.1
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/extensions.js +5 -9
- package/dist/cjs/extensions.js.map +1 -1
- package/dist/cjs/extensions.native.js +37 -0
- package/dist/cjs/extensions.native.js.map +6 -0
- package/dist/cjs/extract.js +32 -80
- package/dist/cjs/extract.js.map +1 -1
- package/dist/cjs/extract.native.js +150 -0
- package/dist/cjs/extract.native.js.map +6 -0
- package/dist/cjs/getVitePath.js +20 -40
- package/dist/cjs/getVitePath.js.map +1 -1
- package/dist/cjs/getVitePath.native.js +54 -0
- package/dist/cjs/getVitePath.native.js.map +6 -0
- package/dist/cjs/index.js +4 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +26 -0
- package/dist/cjs/index.native.js.map +6 -0
- package/dist/cjs/nativePlugin.js +44 -109
- package/dist/cjs/nativePlugin.js.map +2 -2
- package/dist/cjs/nativePlugin.native.js +94 -0
- package/dist/cjs/nativePlugin.native.js.map +6 -0
- package/dist/cjs/plugin.js +22 -25
- package/dist/cjs/plugin.js.map +1 -1
- package/dist/cjs/plugin.native.js +134 -0
- package/dist/cjs/plugin.native.js.map +6 -0
- package/dist/esm/extract.js +24 -63
- package/dist/esm/extract.js.map +1 -1
- package/dist/esm/getVitePath.js +12 -24
- package/dist/esm/getVitePath.js.map +1 -1
- package/dist/esm/nativePlugin.js +36 -89
- package/dist/esm/nativePlugin.js.map +1 -1
- package/dist/esm/plugin.js +17 -16
- package/dist/esm/plugin.js.map +1 -1
- package/package.json +6 -6
- package/src/extract.ts +1 -1
- package/src/plugin.ts +14 -9
- package/types/extract.d.ts +1 -1
- package/types/extract.d.ts.map +1 -1
- package/types/plugin.d.ts +1 -2
- package/types/plugin.d.ts.map +1 -1
- package/dist/cjs/nativePrebuild.js +0 -133
- package/dist/cjs/nativePrebuild.js.map +0 -6
- package/dist/esm/nativePrebuild.js +0 -98
- package/dist/esm/nativePrebuild.js.map +0 -6
- package/types/nativePrebuild.d.ts +0 -7
- package/types/nativePrebuild.d.ts.map +0 -1
package/dist/cjs/extensions.js
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
5
|
var __export = (target, all) => {
|
|
7
6
|
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable:
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
12
10
|
for (let key of __getOwnPropNames(from))
|
|
13
|
-
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
11
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
12
|
return to;
|
|
17
13
|
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value:
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
19
15
|
var extensions_exports = {};
|
|
20
16
|
__export(extensions_exports, {
|
|
21
17
|
extensions: () => extensions
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/extensions.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,aAAa;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
|
+
var extensions_exports = {};
|
|
17
|
+
__export(extensions_exports, {
|
|
18
|
+
extensions: () => extensions
|
|
19
|
+
});
|
|
20
|
+
module.exports = __toCommonJS(extensions_exports);
|
|
21
|
+
const extensions = [
|
|
22
|
+
".ios.js",
|
|
23
|
+
".native.js",
|
|
24
|
+
".native.ts",
|
|
25
|
+
".native.tsx",
|
|
26
|
+
".js",
|
|
27
|
+
".jsx",
|
|
28
|
+
".json",
|
|
29
|
+
".ts",
|
|
30
|
+
".tsx",
|
|
31
|
+
".mjs"
|
|
32
|
+
];
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
extensions
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=extensions.js.map
|
package/dist/cjs/extract.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable:
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
14
11
|
for (let key of __getOwnPropNames(from))
|
|
15
|
-
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
13
|
return to;
|
|
19
14
|
};
|
|
20
15
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
@@ -22,41 +17,25 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
17
|
// file that has been converted to a CommonJS file using a Babel-
|
|
23
18
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
19
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable:
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
26
21
|
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
29
23
|
var extract_exports = {};
|
|
30
24
|
__export(extract_exports, {
|
|
31
25
|
tamaguiExtractPlugin: () => tamaguiExtractPlugin
|
|
32
26
|
});
|
|
33
27
|
module.exports = __toCommonJS(extract_exports);
|
|
34
|
-
var import_path = __toESM(require("path"));
|
|
35
|
-
|
|
36
|
-
var import_outdent = __toESM(require("outdent"));
|
|
37
|
-
var import_vite = require("vite");
|
|
38
|
-
const { createExtractor, extractToClassNames, getPragmaOptions } = Static["default"] || Static;
|
|
39
|
-
const styleUpdateEvent = (fileId) => `tamagui-style-update:${fileId}`;
|
|
40
|
-
const GLOBAL_CSS_VIRTUAL_PATH = "__tamagui_global_css__.css";
|
|
28
|
+
var import_path = __toESM(require("path")), Static = __toESM(require("@tamagui/static")), import_outdent = __toESM(require("outdent")), import_vite = require("vite");
|
|
29
|
+
const { createExtractor, extractToClassNames, getPragmaOptions } = Static.default || Static, styleUpdateEvent = (fileId) => `tamagui-style-update:${fileId}`, GLOBAL_CSS_VIRTUAL_PATH = "__tamagui_global_css__.css";
|
|
41
30
|
function tamaguiExtractPlugin(options) {
|
|
42
|
-
|
|
43
|
-
if (disableStatic) {
|
|
31
|
+
if (options.disable || options.disableDebugAttr && options.disableExtraction)
|
|
44
32
|
return {
|
|
45
33
|
name: "tamagui-extract"
|
|
46
34
|
};
|
|
47
|
-
}
|
|
48
35
|
let extractor = null;
|
|
49
36
|
const cssMap = /* @__PURE__ */ new Map();
|
|
50
|
-
let config;
|
|
51
|
-
|
|
52
|
-
let shouldReturnCSS = true;
|
|
53
|
-
let virtualExt;
|
|
54
|
-
const getAbsoluteVirtualFileId = (filePath) => {
|
|
55
|
-
if (filePath.startsWith(config.root)) {
|
|
56
|
-
return filePath;
|
|
57
|
-
}
|
|
58
|
-
return (0, import_vite.normalizePath)(import_path.default.join(config.root, filePath));
|
|
59
|
-
};
|
|
37
|
+
let config, server, shouldReturnCSS = !0, virtualExt;
|
|
38
|
+
const getAbsoluteVirtualFileId = (filePath) => filePath.startsWith(config.root) ? filePath : (0, import_vite.normalizePath)(import_path.default.join(config.root, filePath));
|
|
60
39
|
return {
|
|
61
40
|
name: "tamagui-extract",
|
|
62
41
|
enforce: "pre",
|
|
@@ -68,37 +47,28 @@ function tamaguiExtractPlugin(options) {
|
|
|
68
47
|
},
|
|
69
48
|
writeBundle(options2, bundle) {
|
|
70
49
|
setTimeout(() => {
|
|
71
|
-
console.warn("some sort of dangling process or osmethign, exit for now...");
|
|
72
|
-
process.exit(0);
|
|
50
|
+
console.warn("some sort of dangling process or osmethign, exit for now..."), process.exit(0);
|
|
73
51
|
}, 100);
|
|
74
52
|
},
|
|
75
53
|
config(_userConfig, env) {
|
|
76
|
-
const include = env.command === "serve" ? ["@tamagui/core/inject-styles"] : [];
|
|
77
54
|
return {
|
|
78
|
-
optimizeDeps: { include }
|
|
55
|
+
optimizeDeps: { include: env.command === "serve" ? ["@tamagui/core/inject-styles"] : [] }
|
|
79
56
|
};
|
|
80
57
|
},
|
|
81
58
|
async configResolved(resolvedConfig) {
|
|
82
|
-
config = resolvedConfig
|
|
83
|
-
extractor = createExtractor({
|
|
59
|
+
config = resolvedConfig, extractor = createExtractor({
|
|
84
60
|
logger: resolvedConfig.logger
|
|
85
|
-
})
|
|
86
|
-
shouldReturnCSS = true;
|
|
87
|
-
virtualExt = `.tamagui.${shouldReturnCSS ? "css" : "js"}`;
|
|
61
|
+
}), shouldReturnCSS = !0, virtualExt = `.tamagui.${shouldReturnCSS ? "css" : "js"}`;
|
|
88
62
|
},
|
|
89
63
|
async resolveId(source) {
|
|
90
|
-
if (source === "tamagui.css")
|
|
91
|
-
await extractor.loadTamagui(options);
|
|
92
|
-
return GLOBAL_CSS_VIRTUAL_PATH;
|
|
93
|
-
}
|
|
64
|
+
if (source === "tamagui.css")
|
|
65
|
+
return await extractor.loadTamagui(options), GLOBAL_CSS_VIRTUAL_PATH;
|
|
94
66
|
const [validId, query] = source.split("?");
|
|
95
|
-
if (!validId.endsWith(virtualExt))
|
|
67
|
+
if (!validId.endsWith(virtualExt))
|
|
96
68
|
return;
|
|
97
|
-
}
|
|
98
69
|
const absoluteId = source.startsWith(config.root) ? source : getAbsoluteVirtualFileId(validId);
|
|
99
|
-
if (cssMap.has(absoluteId))
|
|
70
|
+
if (cssMap.has(absoluteId))
|
|
100
71
|
return absoluteId + (query ? `?${query}` : "");
|
|
101
|
-
}
|
|
102
72
|
},
|
|
103
73
|
/**
|
|
104
74
|
* TODO
|
|
@@ -109,20 +79,13 @@ function tamaguiExtractPlugin(options) {
|
|
|
109
79
|
*/
|
|
110
80
|
load(id, options2) {
|
|
111
81
|
const [validId] = id.split("?");
|
|
112
|
-
if (validId === GLOBAL_CSS_VIRTUAL_PATH)
|
|
82
|
+
if (validId === GLOBAL_CSS_VIRTUAL_PATH)
|
|
113
83
|
return extractor.getTamagui().getCSS();
|
|
114
|
-
|
|
115
|
-
if (!cssMap.has(validId)) {
|
|
84
|
+
if (!cssMap.has(validId))
|
|
116
85
|
return;
|
|
117
|
-
}
|
|
118
86
|
const css = cssMap.get(validId);
|
|
119
|
-
if (typeof css
|
|
120
|
-
return
|
|
121
|
-
}
|
|
122
|
-
if (shouldReturnCSS || !server || server.config.isProduction) {
|
|
123
|
-
return css;
|
|
124
|
-
}
|
|
125
|
-
return import_outdent.default`
|
|
87
|
+
if (typeof css == "string")
|
|
88
|
+
return shouldReturnCSS || !server || server.config.isProduction ? css : import_outdent.default`
|
|
126
89
|
import { injectStyles } from '@tamagui/core/inject-styles';
|
|
127
90
|
|
|
128
91
|
const inject = (css) => injectStyles({
|
|
@@ -141,17 +104,14 @@ function tamaguiExtractPlugin(options) {
|
|
|
141
104
|
},
|
|
142
105
|
async transform(code, id, ssrParam) {
|
|
143
106
|
const [validId] = id.split("?");
|
|
144
|
-
if (!validId.endsWith(".tsx"))
|
|
107
|
+
if (!validId.endsWith(".tsx"))
|
|
145
108
|
return;
|
|
146
|
-
}
|
|
147
|
-
const firstCommentIndex = code.indexOf("// ");
|
|
148
|
-
const { shouldDisable, shouldPrintDebug } = getPragmaOptions({
|
|
109
|
+
const firstCommentIndex = code.indexOf("// "), { shouldDisable, shouldPrintDebug } = getPragmaOptions({
|
|
149
110
|
source: firstCommentIndex >= 0 ? code.slice(firstCommentIndex) : "",
|
|
150
111
|
path: validId
|
|
151
112
|
});
|
|
152
|
-
if (shouldDisable)
|
|
113
|
+
if (shouldDisable)
|
|
153
114
|
return;
|
|
154
|
-
}
|
|
155
115
|
const extracted = await extractToClassNames({
|
|
156
116
|
extractor,
|
|
157
117
|
source: code,
|
|
@@ -159,29 +119,21 @@ function tamaguiExtractPlugin(options) {
|
|
|
159
119
|
options,
|
|
160
120
|
shouldPrintDebug
|
|
161
121
|
});
|
|
162
|
-
if (!extracted)
|
|
122
|
+
if (!extracted)
|
|
163
123
|
return;
|
|
164
|
-
}
|
|
165
|
-
const rootRelativeId = `${validId}${virtualExt}`;
|
|
166
|
-
const absoluteId = getAbsoluteVirtualFileId(rootRelativeId);
|
|
124
|
+
const rootRelativeId = `${validId}${virtualExt}`, absoluteId = getAbsoluteVirtualFileId(rootRelativeId);
|
|
167
125
|
let source = extracted.js;
|
|
168
126
|
if (extracted.styles) {
|
|
169
127
|
if (server && cssMap.has(absoluteId) && cssMap.get(absoluteId) !== extracted.styles) {
|
|
170
|
-
const { moduleGraph } = server;
|
|
171
|
-
|
|
172
|
-
if (module2) {
|
|
173
|
-
moduleGraph.invalidateModule(module2);
|
|
174
|
-
module2.lastHMRTimestamp = module2.lastInvalidationTimestamp || Date.now();
|
|
175
|
-
}
|
|
176
|
-
server.ws.send({
|
|
128
|
+
const { moduleGraph } = server, [module2] = Array.from(moduleGraph.getModulesByFile(absoluteId) || []);
|
|
129
|
+
module2 && (moduleGraph.invalidateModule(module2), module2.lastHMRTimestamp = module2.lastInvalidationTimestamp || Date.now()), server.ws.send({
|
|
177
130
|
type: "custom",
|
|
178
131
|
event: styleUpdateEvent(absoluteId),
|
|
179
132
|
data: extracted.styles
|
|
180
133
|
});
|
|
181
134
|
}
|
|
182
135
|
source = `${source}
|
|
183
|
-
import "${rootRelativeId}"
|
|
184
|
-
cssMap.set(absoluteId, extracted.styles);
|
|
136
|
+
import "${rootRelativeId}";`, cssMap.set(absoluteId, extracted.styles);
|
|
185
137
|
}
|
|
186
138
|
return {
|
|
187
139
|
code: source.toString(),
|
package/dist/cjs/extract.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/extract.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAiB,0BAGjB,SAAwB,qCACxB,iBAAoB,6BAEpB,cAA8B;AAE9B,MAAM,EAAE,iBAAiB,qBAAqB,iBAAiB,IAC7D,OAAO,WAAc,QAEjB,mBAAmB,CAAC,WAAmB,wBAAwB,MAAM,IACrE,0BAA0B;AAEzB,SAAS,qBAAqB,SAA0C;AAI7E,MAFE,QAAQ,WAAY,QAAQ,oBAAoB,QAAQ;AAGxD,WAAO;AAAA,MACL,MAAM;AAAA,IACR;AAGF,MAAI,YAAuD;AAC3D,QAAM,SAAS,oBAAI,IAAoB;AAEvC,MAAI,QACA,QACA,kBAAkB,IAClB;AAEJ,QAAM,2BAA2B,CAAC,aAC5B,SAAS,WAAW,OAAO,IAAI,IAC1B,eAEF,2BAAc,YAAAA,QAAK,KAAK,OAAO,MA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AClB,CAAC;AAAA,QACH;AAEA,iBAAS,GAAG,MAAM;AAAA,UAAa,cAAc,MAC7C,OAAO,IAAI,YAAY,UAAU,MAAM;AAAA,MACzC;AAEA,aAAO;AAAA,QACL,MAAM,OAAO,SAAS;AAAA,QACtB,KAAK,UAAU;AAAA,MACjB;AAAA,IAwBF;AAAA,EACF;AACF;",
|
|
5
5
|
"names": ["path", "options", "outdent", "module"]
|
|
6
6
|
}
|
|
@@ -0,0 +1,150 @@
|
|
|
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, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
10
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
22
|
+
mod
|
|
23
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
24
|
+
var extract_exports = {};
|
|
25
|
+
__export(extract_exports, {
|
|
26
|
+
tamaguiExtractPlugin: () => tamaguiExtractPlugin
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(extract_exports);
|
|
29
|
+
var import_path = __toESM(require("path")), Static = __toESM(require("@tamagui/static")), import_outdent = __toESM(require("outdent")), import_vite = require("vite");
|
|
30
|
+
const { createExtractor, extractToClassNames, getPragmaOptions } = Static.default || Static, styleUpdateEvent = (fileId) => `tamagui-style-update:${fileId}`, GLOBAL_CSS_VIRTUAL_PATH = "__tamagui_global_css__.css";
|
|
31
|
+
function tamaguiExtractPlugin(options) {
|
|
32
|
+
if (options.disable || options.disableDebugAttr && options.disableExtraction)
|
|
33
|
+
return {
|
|
34
|
+
name: "tamagui-extract"
|
|
35
|
+
};
|
|
36
|
+
let extractor = null;
|
|
37
|
+
const cssMap = /* @__PURE__ */ new Map();
|
|
38
|
+
let config, server, shouldReturnCSS = !0, virtualExt;
|
|
39
|
+
const getAbsoluteVirtualFileId = (filePath) => filePath.startsWith(config.root) ? filePath : (0, import_vite.normalizePath)(import_path.default.join(config.root, filePath));
|
|
40
|
+
return {
|
|
41
|
+
name: "tamagui-extract",
|
|
42
|
+
enforce: "pre",
|
|
43
|
+
configureServer(_server) {
|
|
44
|
+
server = _server;
|
|
45
|
+
},
|
|
46
|
+
buildEnd() {
|
|
47
|
+
extractor.cleanupBeforeExit();
|
|
48
|
+
},
|
|
49
|
+
writeBundle(options2, bundle) {
|
|
50
|
+
setTimeout(() => {
|
|
51
|
+
console.warn("some sort of dangling process or osmethign, exit for now..."), process.exit(0);
|
|
52
|
+
}, 100);
|
|
53
|
+
},
|
|
54
|
+
config(_userConfig, env) {
|
|
55
|
+
return {
|
|
56
|
+
optimizeDeps: { include: env.command === "serve" ? ["@tamagui/core/inject-styles"] : [] }
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
async configResolved(resolvedConfig) {
|
|
60
|
+
config = resolvedConfig, extractor = createExtractor({
|
|
61
|
+
logger: resolvedConfig.logger
|
|
62
|
+
}), shouldReturnCSS = !0, virtualExt = `.tamagui.${shouldReturnCSS ? "css" : "js"}`;
|
|
63
|
+
},
|
|
64
|
+
async resolveId(source) {
|
|
65
|
+
if (source === "tamagui.css")
|
|
66
|
+
return await extractor.loadTamagui(options), GLOBAL_CSS_VIRTUAL_PATH;
|
|
67
|
+
const [validId, query] = source.split("?");
|
|
68
|
+
if (!validId.endsWith(virtualExt))
|
|
69
|
+
return;
|
|
70
|
+
const absoluteId = source.startsWith(config.root) ? source : getAbsoluteVirtualFileId(validId);
|
|
71
|
+
if (cssMap.has(absoluteId))
|
|
72
|
+
return absoluteId + (query ? `?${query}` : "");
|
|
73
|
+
},
|
|
74
|
+
/**
|
|
75
|
+
* TODO
|
|
76
|
+
*
|
|
77
|
+
* mainFields module:jsx breaks, so lets just have a mapping here
|
|
78
|
+
* where we load() and map it to the jsx path before transform
|
|
79
|
+
*
|
|
80
|
+
*/
|
|
81
|
+
load(id, options2) {
|
|
82
|
+
const [validId] = id.split("?");
|
|
83
|
+
if (validId === GLOBAL_CSS_VIRTUAL_PATH)
|
|
84
|
+
return extractor.getTamagui().getCSS();
|
|
85
|
+
if (!cssMap.has(validId))
|
|
86
|
+
return;
|
|
87
|
+
const css = cssMap.get(validId);
|
|
88
|
+
if (typeof css == "string")
|
|
89
|
+
return shouldReturnCSS || !server || server.config.isProduction ? css : import_outdent.default`
|
|
90
|
+
import { injectStyles } from '@tamagui/core/inject-styles';
|
|
91
|
+
|
|
92
|
+
const inject = (css) => injectStyles({
|
|
93
|
+
filePath: "${validId}",
|
|
94
|
+
css
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
inject(${JSON.stringify(css)});
|
|
98
|
+
|
|
99
|
+
if (import.meta.hot) {
|
|
100
|
+
import.meta.hot.on('${styleUpdateEvent(validId)}', (css) => {
|
|
101
|
+
inject(css);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
`;
|
|
105
|
+
},
|
|
106
|
+
async transform(code, id, ssrParam) {
|
|
107
|
+
const [validId] = id.split("?");
|
|
108
|
+
if (!validId.endsWith(".tsx"))
|
|
109
|
+
return;
|
|
110
|
+
const firstCommentIndex = code.indexOf("// "), { shouldDisable, shouldPrintDebug } = getPragmaOptions({
|
|
111
|
+
source: firstCommentIndex >= 0 ? code.slice(firstCommentIndex) : "",
|
|
112
|
+
path: validId
|
|
113
|
+
});
|
|
114
|
+
if (shouldDisable)
|
|
115
|
+
return;
|
|
116
|
+
const extracted = await extractToClassNames({
|
|
117
|
+
extractor,
|
|
118
|
+
source: code,
|
|
119
|
+
sourcePath: validId,
|
|
120
|
+
options,
|
|
121
|
+
shouldPrintDebug
|
|
122
|
+
});
|
|
123
|
+
if (!extracted)
|
|
124
|
+
return;
|
|
125
|
+
const rootRelativeId = `${validId}${virtualExt}`, absoluteId = getAbsoluteVirtualFileId(rootRelativeId);
|
|
126
|
+
let source = extracted.js;
|
|
127
|
+
if (extracted.styles) {
|
|
128
|
+
if (server && cssMap.has(absoluteId) && cssMap.get(absoluteId) !== extracted.styles) {
|
|
129
|
+
const { moduleGraph } = server, [module2] = Array.from(moduleGraph.getModulesByFile(absoluteId) || []);
|
|
130
|
+
module2 && (moduleGraph.invalidateModule(module2), module2.lastHMRTimestamp = module2.lastInvalidationTimestamp || Date.now()), server.ws.send({
|
|
131
|
+
type: "custom",
|
|
132
|
+
event: styleUpdateEvent(absoluteId),
|
|
133
|
+
data: extracted.styles
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
source = `${source}
|
|
137
|
+
import "${rootRelativeId}";`, cssMap.set(absoluteId, extracted.styles);
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
code: source.toString(),
|
|
141
|
+
map: extracted.map
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
147
|
+
0 && (module.exports = {
|
|
148
|
+
tamaguiExtractPlugin
|
|
149
|
+
});
|
|
150
|
+
//# sourceMappingURL=extract.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/extract.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAiB,0BAGjB,SAAwB,qCACxB,iBAAoB,6BAEpB,cAA8B;AAE9B,MAAM,EAAE,iBAAiB,qBAAqB,iBAAiB,IAC7D,OAAO,WAAc,QAEjB,mBAAmB,CAAC,WAAmB,wBAAwB,MAAM,IACrE,0BAA0B;AAEzB,SAAS,qBAAqB,SAA0C;AAI7E,MAFE,QAAQ,WAAY,QAAQ,oBAAoB,QAAQ;AAGxD,WAAO;AAAA,MACL,MAAM;AAAA,IACR;AAGF,MAAI,YAAuD;AAC3D,QAAM,SAAS,oBAAI,IAAoB;AAEvC,MAAI,QACA,QACA,kBAAkB,IAClB;AAEJ,QAAM,2BAA2B,CAAC,aAC5B,SAAS,WAAW,OAAO,IAAI,IAC1B,eAEF,2BAAc,YAAAA,QAAK,KAAK,OAAO,MAAM,QAAQ,CAAC;AAGvD,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IAET,gBAAgB,SAAS;AACvB,eAAS;AAAA,IACX;AAAA,IAEA,WAAW;AACT,gBAAW,kBAAkB;AAAA,IAC/B;AAAA,IAEA,YAAkBC,UAAS,QAAQ;AACjC,iBAAW,MAAM;AAEf,gBAAQ,KAAK,6DAA6D,GAC1E,QAAQ,KAAK,CAAC;AAAA,MAChB,GAAG,GAAG;AAAA,IACR;AAAA,IAEA,OAAO,aAAa,KAAK;AAEvB,aAAO;AAAA,QACL,cAAc,EAAE,SAFF,IAAI,YAAY,UAAU,CAAC,6BAA6B,IAAI,CAAC,EAEnD;AAAA,MAC1B;AAAA,IAC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eAAe,iBAAiB,IAAI,iBAAiB;AAAA,QAC3D,QAAQ,qBAAqB,IAAI,KAAK,MAAM,iBAAiB,IAAI;AAAA,QACjE,MAAM;AAAA,MACR,CAAC;AAED,UAAI;AACF;AAGF,YAAM,YAAY,MAAM,oBAAoB;AAAA,QAC1C;AAAA,QACA,QAAQ;AAAA,QACR,YAAY;AAAA,QACZ;AAAA,QACA;AAAA,MACF,CAAC;AAED,UAAI,CAAC;AACH;AAGF,YAAM,iBAAiB,GAAG,OAAO,GAAG,UAAU,IACxC,aAAa,yBAAyB,cAAc;AAE1D,UAAI,SAAS,UAAU;AAEvB,UAAI,UAAU,QAAQ;AACpB,YACE,UACA,OAAO,IAAI,UAAU,KACrB,OAAO,IAAI,UAAU,MAAM,UAAU,QACrC;AACA,gBAAM,EAAE,YAAY,IAAI,QAClB,CAACC,OAAM,IAAI,MAAM,KAAK,YAAY,iBAAiB,UAAU,KAAK,CAAC,CAAC;AAE1E,UAAIA,YACF,YAAY,iBAAiBA,OAAM,GAGnCA,QAAO,mBACJA,QAAe,6BAA6B,KAAK,IAAI,IAG1D,OAAO,GAAG,KAAK;AAAA,YACb,MAAM;AAAA,YACN,OAAO,iBAAiB,UAAU;AAAA,YAClC,MAAM,UAAU;AAAA,UAClB,CAAC;AAAA,QACH;AAEA,iBAAS,GAAG,MAAM;AAAA,UAAa,cAAc,MAC7C,OAAO,IAAI,YAAY,UAAU,MAAM;AAAA,MACzC;AAEA,aAAO;AAAA,QACL,MAAM,OAAO,SAAS;AAAA,QACtB,KAAK,UAAU;AAAA,MACjB;AAAA,IAwBF;AAAA,EACF;AACF;",
|
|
5
|
+
"names": ["path", "options", "outdent", "module"]
|
|
6
|
+
}
|
package/dist/cjs/getVitePath.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable:
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
14
11
|
for (let key of __getOwnPropNames(from))
|
|
15
|
-
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
13
|
return to;
|
|
19
14
|
};
|
|
20
15
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
@@ -22,48 +17,33 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
17
|
// file that has been converted to a CommonJS file using a Babel-
|
|
23
18
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
19
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable:
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
26
21
|
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
29
23
|
var getVitePath_exports = {};
|
|
30
24
|
__export(getVitePath_exports, {
|
|
31
25
|
getVitePath: () => getVitePath
|
|
32
26
|
});
|
|
33
27
|
module.exports = __toCommonJS(getVitePath_exports);
|
|
34
|
-
var import_path = require("path");
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
async function getVitePath(importer, moduleName, absolute = false) {
|
|
38
|
-
if (moduleName === "react-native") {
|
|
28
|
+
var import_path = require("path"), import_esm_resolve = __toESM(require("esm-resolve")), import_fs_extra = require("fs-extra");
|
|
29
|
+
async function getVitePath(importer, moduleName, absolute = !1) {
|
|
30
|
+
if (moduleName === "react-native")
|
|
39
31
|
return "react-native";
|
|
40
|
-
|
|
41
|
-
if (moduleName === "react") {
|
|
32
|
+
if (moduleName === "react")
|
|
42
33
|
return "react";
|
|
43
|
-
|
|
44
|
-
if (moduleName === "react/jsx-runtime") {
|
|
34
|
+
if (moduleName === "react/jsx-runtime")
|
|
45
35
|
return "react/jsx-runtime";
|
|
46
|
-
|
|
47
|
-
if (moduleName === "react/jsx-dev-runtime") {
|
|
36
|
+
if (moduleName === "react/jsx-dev-runtime")
|
|
48
37
|
return "react/jsx-dev-runtime";
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (!resolved) {
|
|
56
|
-
throw new Error(`\u274C cant find`);
|
|
57
|
-
}
|
|
38
|
+
if (moduleName[0] === ".")
|
|
39
|
+
return (0, import_path.join)("apps/tamastack/src", moduleName) + ".js";
|
|
40
|
+
{
|
|
41
|
+
const sourceFile = (0, import_path.join)(process.cwd(), "index.js"), resolved = (0, import_esm_resolve.default)(sourceFile)(moduleName);
|
|
42
|
+
if (!resolved)
|
|
43
|
+
throw new Error("\u274C cant find");
|
|
58
44
|
const real = await (0, import_fs_extra.realpath)(resolved);
|
|
59
45
|
let id = real;
|
|
60
|
-
|
|
61
|
-
id = (0, import_path.relative)(importer, real);
|
|
62
|
-
}
|
|
63
|
-
if (id.endsWith(`/react/jsx-dev-runtime.js`)) {
|
|
64
|
-
id = "react/jsx-runtime";
|
|
65
|
-
}
|
|
66
|
-
return id;
|
|
46
|
+
return absolute || (id = (0, import_path.relative)(importer, real)), id.endsWith("/react/jsx-dev-runtime.js") && (id = "react/jsx-runtime"), id;
|
|
67
47
|
}
|
|
68
48
|
}
|
|
69
49
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/getVitePath.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA+B,iBAE/B,qBAAoB,iCACpB,kBAAyB;AAEzB,eAAsB,YACpB,UACA,YACA,WAAW,IACX;AAEA,MAAI,eAAe;AACjB,WAAO;AAET,MAAI,eAAe;AACjB,WAAO;AAET,MAAI,eAAe;AACjB,WAAO;AAET,MAAI,eAAe;AACjB,WAAO;AAGT,MAAI,WAAW,CAAC,MAAM;AAEpB,eAAO,kBAAK,sBAAsB,UAAU,IAAI;AAC3C;AACL,UAAM,iBAAa,kBAAK,QAAQ,IAAI,GAAG,UAAU,GAC3C,eAAW,mBAAAA,SAAQ,UAAU,EAAE,UAAU;AAE/C,QAAI,CAAC;AACH,YAAM,IAAI,MAAM,kBAAa;AAE/B,UAAM,OAAO,UAAM,0BAAS,QAAQ;AACpC,QAAI,KAAK;AACT,WAAK,aACH,SAAK,sBAAS,UAAU,IAAI,IAE1B,GAAG,SAAS,2BAA2B,MACzC,KAAK,sBAEA;AAAA,EACT;AACF;",
|
|
5
5
|
"names": ["resolve"]
|
|
6
6
|
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
10
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
22
|
+
mod
|
|
23
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
24
|
+
var getVitePath_exports = {};
|
|
25
|
+
__export(getVitePath_exports, {
|
|
26
|
+
getVitePath: () => getVitePath
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(getVitePath_exports);
|
|
29
|
+
var import_path = require("path"), import_esm_resolve = __toESM(require("esm-resolve")), import_fs_extra = require("fs-extra");
|
|
30
|
+
async function getVitePath(importer, moduleName, absolute = !1) {
|
|
31
|
+
if (moduleName === "react-native")
|
|
32
|
+
return "react-native";
|
|
33
|
+
if (moduleName === "react")
|
|
34
|
+
return "react";
|
|
35
|
+
if (moduleName === "react/jsx-runtime")
|
|
36
|
+
return "react/jsx-runtime";
|
|
37
|
+
if (moduleName === "react/jsx-dev-runtime")
|
|
38
|
+
return "react/jsx-dev-runtime";
|
|
39
|
+
if (moduleName[0] === ".")
|
|
40
|
+
return (0, import_path.join)("apps/tamastack/src", moduleName) + ".js";
|
|
41
|
+
{
|
|
42
|
+
const sourceFile = (0, import_path.join)(process.cwd(), "index.js"), resolved = (0, import_esm_resolve.default)(sourceFile)(moduleName);
|
|
43
|
+
if (!resolved)
|
|
44
|
+
throw new Error("\u274C cant find");
|
|
45
|
+
const real = await (0, import_fs_extra.realpath)(resolved);
|
|
46
|
+
let id = real;
|
|
47
|
+
return absolute || (id = (0, import_path.relative)(importer, real)), id.endsWith("/react/jsx-dev-runtime.js") && (id = "react/jsx-runtime"), id;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
getVitePath
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=getVitePath.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/getVitePath.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA+B,iBAE/B,qBAAoB,iCACpB,kBAAyB;AAEzB,eAAsB,YACpB,UACA,YACA,WAAW,IACX;AAEA,MAAI,eAAe;AACjB,WAAO;AAET,MAAI,eAAe;AACjB,WAAO;AAET,MAAI,eAAe;AACjB,WAAO;AAET,MAAI,eAAe;AACjB,WAAO;AAGT,MAAI,WAAW,CAAC,MAAM;AAEpB,eAAO,kBAAK,sBAAsB,UAAU,IAAI;AAC3C;AACL,UAAM,iBAAa,kBAAK,QAAQ,IAAI,GAAG,UAAU,GAC3C,eAAW,mBAAAA,SAAQ,UAAU,EAAE,UAAU;AAE/C,QAAI,CAAC;AACH,YAAM,IAAI,MAAM,kBAAa;AAE/B,UAAM,OAAO,UAAM,0BAAS,QAAQ;AACpC,QAAI,KAAK;AACT,WAAK,aACH,SAAK,sBAAS,UAAU,IAAI,IAE1B,GAAG,SAAS,2BAA2B,MACzC,KAAK,sBAEA;AAAA,EACT;AACF;",
|
|
5
|
+
"names": ["resolve"]
|
|
6
|
+
}
|