@tamagui/cli 1.52.3 → 1.52.5
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/dev/clientInjectPlugin.js +104 -0
- package/dist/dev/clientInjectPlugin.js.map +6 -0
- package/dist/dev/createDevServer.js +59 -39
- package/dist/dev/createDevServer.js.map +2 -2
- package/dist/dev/types.js +17 -0
- package/dist/dev/types.js.map +6 -0
- package/dist/dev.js +144 -87
- package/dist/dev.js.map +2 -2
- package/dist/vendor/repack/dev-server/src/createServer.js +15 -2
- package/dist/vendor/repack/dev-server/src/createServer.js.map +2 -2
- package/dist/vendor/repack/dev-server/src/plugins/wss/WebSocketRouter.js +0 -3
- package/dist/vendor/repack/dev-server/src/plugins/wss/WebSocketRouter.js.map +1 -1
- package/dist/vendor/repack/dev-server/src/plugins/wss/servers/HermesInspectorProxy.js +1 -1
- package/dist/vendor/repack/dev-server/src/plugins/wss/servers/HermesInspectorProxy.js.map +1 -1
- package/dist/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketApiServer.js +4 -1
- package/dist/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketApiServer.js.map +1 -1
- package/dist/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketEventsServer.js +1 -0
- package/dist/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketEventsServer.js.map +1 -1
- package/dist/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketHMRServer.js +2 -2
- package/dist/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketHMRServer.js.map +1 -1
- package/dist/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketMessageServer.js +1 -0
- package/dist/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketMessageServer.js.map +1 -1
- package/dist/vendor/repack/dev-server/src/plugins/wss/wssPlugin.js +4 -1
- package/dist/vendor/repack/dev-server/src/plugins/wss/wssPlugin.js.map +1 -1
- package/dist/vendor/repack/dev-server/src/types.js.map +1 -1
- package/package.json +11 -7
- package/src/dev/clientInjectPlugin.ts +112 -0
- package/src/dev/createDevServer.ts +59 -47
- package/src/dev/types.ts +1 -0
- package/src/dev.ts +197 -95
- package/src/vendor/repack/dev-server/src/createServer.ts +17 -7
- package/src/vendor/repack/dev-server/src/plugins/wss/WebSocketRouter.ts +1 -5
- package/src/vendor/repack/dev-server/src/plugins/wss/servers/HermesInspectorProxy.ts +1 -1
- package/src/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketApiServer.ts +4 -1
- package/src/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketEventsServer.ts +3 -0
- package/src/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketHMRServer.ts +2 -2
- package/src/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketMessageServer.ts +3 -0
- package/src/vendor/repack/dev-server/src/plugins/wss/wssPlugin.ts +5 -5
- package/src/vendor/repack/dev-server/src/types.ts +4 -0
- package/types/dev/WebpackHMRClient.d.ts +1 -0
- package/types/dev/clientInjectPlugin.d.ts +7 -0
- package/types/dev/clientInjectPlugin.d.ts.map +1 -0
- package/types/dev/createDevServer.d.ts +4 -1
- package/types/dev/createDevServer.d.ts.map +1 -1
- package/types/dev/types.d.ts +5 -0
- package/types/dev/types.d.ts.map +1 -0
- package/types/dev.d.ts.map +1 -1
- package/types/vendor/repack/dev-server/src/createServer.d.ts.map +1 -1
- package/types/vendor/repack/dev-server/src/plugins/wss/WebSocketRouter.d.ts.map +1 -1
- package/types/vendor/repack/dev-server/src/plugins/wss/servers/HermesInspectorProxy.d.ts.map +1 -1
- package/types/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketApiServer.d.ts.map +1 -1
- package/types/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketEventsServer.d.ts.map +1 -1
- package/types/vendor/repack/dev-server/src/plugins/wss/servers/WebSocketMessageServer.d.ts.map +1 -1
- package/types/vendor/repack/dev-server/src/plugins/wss/wssPlugin.d.ts +2 -0
- package/types/vendor/repack/dev-server/src/plugins/wss/wssPlugin.d.ts.map +1 -1
- package/types/vendor/repack/dev-server/src/types.d.ts +3 -0
- package/types/vendor/repack/dev-server/src/types.d.ts.map +1 -1
- package/src/vendor/repack/dev-server/vendor/metro-inspector-proxy/src/Device.cjs +0 -1
- package/src/vendor/repack/dev-server/vendor/metro-inspector-proxy/src/Device.js +0 -1
|
@@ -0,0 +1,104 @@
|
|
|
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
|
+
var clientInjectPlugin_exports = {};
|
|
30
|
+
__export(clientInjectPlugin_exports, {
|
|
31
|
+
clientInjectionsPlugin: () => clientInjectionsPlugin
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(clientInjectPlugin_exports);
|
|
34
|
+
var import_node_path = __toESM(require("node:path"));
|
|
35
|
+
const process_env_NODE_ENV_RE = /(\bglobal(This)?\.)?\bprocess\.env\.NODE_ENV\b/g;
|
|
36
|
+
const isObject = (x) => x && typeof x === "object";
|
|
37
|
+
function clientInjectionsPlugin(config) {
|
|
38
|
+
let injectConfigValues;
|
|
39
|
+
return {
|
|
40
|
+
name: "vite:client-inject",
|
|
41
|
+
async buildStart() {
|
|
42
|
+
const resolvedServerHostname = "127.0.0.1";
|
|
43
|
+
const resolvedServerPort = config.server.port || 5173;
|
|
44
|
+
const devBase = config.base || "/";
|
|
45
|
+
const serverHost = `${resolvedServerHostname}:${resolvedServerPort}${devBase}`;
|
|
46
|
+
let hmrConfig = config.server.hmr;
|
|
47
|
+
hmrConfig = isObject(hmrConfig) ? hmrConfig : void 0;
|
|
48
|
+
const host = (hmrConfig == null ? void 0 : hmrConfig.host) || null;
|
|
49
|
+
const protocol = (hmrConfig == null ? void 0 : hmrConfig.protocol) || null;
|
|
50
|
+
const timeout = (hmrConfig == null ? void 0 : hmrConfig.timeout) || 3e4;
|
|
51
|
+
const overlay = (hmrConfig == null ? void 0 : hmrConfig.overlay) !== false;
|
|
52
|
+
const isHmrServerSpecified = !!(hmrConfig == null ? void 0 : hmrConfig.server);
|
|
53
|
+
let port = (hmrConfig == null ? void 0 : hmrConfig.clientPort) || (hmrConfig == null ? void 0 : hmrConfig.port) || null;
|
|
54
|
+
if (config.server.middlewareMode && !isHmrServerSpecified) {
|
|
55
|
+
port || (port = 24678);
|
|
56
|
+
}
|
|
57
|
+
let directTarget = (hmrConfig == null ? void 0 : hmrConfig.host) || resolvedServerHostname;
|
|
58
|
+
directTarget += `:${(hmrConfig == null ? void 0 : hmrConfig.port) || resolvedServerPort}`;
|
|
59
|
+
directTarget += devBase;
|
|
60
|
+
let hmrBase = devBase;
|
|
61
|
+
if (hmrConfig == null ? void 0 : hmrConfig.path) {
|
|
62
|
+
hmrBase = import_node_path.default.posix.join(hmrBase, hmrConfig.path);
|
|
63
|
+
}
|
|
64
|
+
const serializedDefines = serializeDefine(config.define || {});
|
|
65
|
+
const modeReplacement = escapeReplacement(config.mode);
|
|
66
|
+
const baseReplacement = escapeReplacement(devBase);
|
|
67
|
+
const definesReplacement = () => serializedDefines;
|
|
68
|
+
const serverHostReplacement = escapeReplacement(serverHost);
|
|
69
|
+
const hmrProtocolReplacement = escapeReplacement(protocol);
|
|
70
|
+
const hmrHostnameReplacement = escapeReplacement(host);
|
|
71
|
+
const hmrPortReplacement = escapeReplacement(port);
|
|
72
|
+
const hmrDirectTargetReplacement = escapeReplacement(directTarget);
|
|
73
|
+
const hmrBaseReplacement = escapeReplacement(hmrBase);
|
|
74
|
+
const hmrTimeoutReplacement = escapeReplacement(timeout);
|
|
75
|
+
const hmrEnableOverlayReplacement = escapeReplacement(overlay);
|
|
76
|
+
injectConfigValues = (code) => {
|
|
77
|
+
return code.replace(`__MODE__`, modeReplacement).replace(/__BASE__/g, baseReplacement).replace(`__DEFINES__`, definesReplacement).replace(`__SERVER_HOST__`, serverHostReplacement).replace(`__HMR_PROTOCOL__`, hmrProtocolReplacement).replace(`__HMR_HOSTNAME__`, hmrHostnameReplacement).replace(`__HMR_PORT__`, hmrPortReplacement).replace(`__HMR_DIRECT_TARGET__`, hmrDirectTargetReplacement).replace(`__HMR_BASE__`, hmrBaseReplacement).replace(`__HMR_TIMEOUT__`, hmrTimeoutReplacement).replace(`__HMR_ENABLE_OVERLAY__`, hmrEnableOverlayReplacement);
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
transform(code, id, options) {
|
|
81
|
+
if (id.endsWith("vite-native-client/dist/esm/client.js")) {
|
|
82
|
+
return injectConfigValues(code);
|
|
83
|
+
} else if (!(options == null ? void 0 : options.ssr) && code.includes("process.env.NODE_ENV")) {
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function escapeReplacement(value) {
|
|
89
|
+
const jsonValue = JSON.stringify(value);
|
|
90
|
+
return () => jsonValue;
|
|
91
|
+
}
|
|
92
|
+
function serializeDefine(define) {
|
|
93
|
+
let res = `{`;
|
|
94
|
+
for (const key in define) {
|
|
95
|
+
const val = define[key];
|
|
96
|
+
res += `${JSON.stringify(key)}: ${typeof val === "string" ? `(${val})` : JSON.stringify(val)}, `;
|
|
97
|
+
}
|
|
98
|
+
return res + `}`;
|
|
99
|
+
}
|
|
100
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
101
|
+
0 && (module.exports = {
|
|
102
|
+
clientInjectionsPlugin
|
|
103
|
+
});
|
|
104
|
+
//# sourceMappingURL=clientInjectPlugin.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dev/clientInjectPlugin.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAiB;AAIjB,MAAM,0BAA0B;AAEhC,MAAM,WAAW,CAAC,MAAwB,KAAK,OAAO,MAAM;AAMrD,SAAS,uBAAuB,QAAgC;AACrE,MAAI;AAEJ,SAAO;AAAA,IACL,MAAM;AAAA,IAEN,MAAM,aAAa;AACjB,YAAM,yBAAyB;AAC/B,YAAM,qBAAqB,OAAO,OAAQ,QAAS;AACnD,YAAM,UAAU,OAAO,QAAQ;AAE/B,YAAM,aAAa,GAAG,sBAAsB,IAAI,kBAAkB,GAAG,OAAO;AAE5E,UAAI,YAAY,OAAO,OAAQ;AAC/B,kBAAY,SAAS,SAAS,IAAK,YAA2B;AAE9D,YAAM,QAAO,uCAAW,SAAQ;AAChC,YAAM,YAAW,uCAAW,aAAY;AACxC,YAAM,WAAU,uCAAW,YAAW;AACtC,YAAM,WAAU,uCAAW,aAAY;AACvC,YAAM,uBAAuB,CAAC,EAAC,uCAAW;AAI1C,UAAI,QAAO,uCAAW,gBAAc,uCAAW,SAAQ;AACvD,UAAI,OAAO,OAAO,kBAAkB,CAAC,sBAAsB;AACzD,wBAAS;AAAA,MACX;AAEA,UAAI,gBAAe,uCAAW,SAAQ;AACtC,sBAAgB,KAAI,uCAAW,SAAQ,kBAAkB;AACzD,sBAAgB;AAEhB,UAAI,UAAU;AACd,UAAI,uCAAW,MAAM;AACnB,kBAAU,iBAAAA,QAAK,MAAM,KAAK,SAAS,UAAU,IAAI;AAAA,MACnD;AAEA,YAAM,oBAAoB,gBAAgB,OAAO,UAAU,CAAC,CAAC;AAE7D,YAAM,kBAAkB,kBAAkB,OAAO,IAAK;AACtD,YAAM,kBAAkB,kBAAkB,OAAO;AACjD,YAAM,qBAAqB,MAAM;AACjC,YAAM,wBAAwB,kBAAkB,UAAU;AAC1D,YAAM,yBAAyB,kBAAkB,QAAQ;AACzD,YAAM,yBAAyB,kBAAkB,IAAI;AACrD,YAAM,qBAAqB,kBAAkB,IAAI;AACjD,YAAM,6BAA6B,kBAAkB,YAAY;AACjE,YAAM,qBAAqB,kBAAkB,OAAO;AACpD,YAAM,wBAAwB,kBAAkB,OAAO;AACvD,YAAM,8BAA8B,kBAAkB,OAAO;AAE7D,2BAAqB,CAAC,SAAiB;AACrC,eAAO,KACJ,QAAQ,YAAY,eAAe,EACnC,QAAQ,aAAa,eAAe,EACpC,QAAQ,eAAe,kBAAkB,EACzC,QAAQ,mBAAmB,qBAAqB,EAChD,QAAQ,oBAAoB,sBAAsB,EAClD,QAAQ,oBAAoB,sBAAsB,EAClD,QAAQ,gBAAgB,kBAAkB,EAC1C,QAAQ,yBAAyB,0BAA0B,EAC3D,QAAQ,gBAAgB,kBAAkB,EAC1C,QAAQ,mBAAmB,qBAAqB,EAChD,QAAQ,0BAA0B,2BAA2B;AAAA,MAClE;AAAA,IACF;AAAA,IAEA,UAAU,MAAM,IAAI,SAAS;AAC3B,UAAI,GAAG,SAAS,uCAAuC,GAAG;AACxD,eAAO,mBAAmB,IAAI;AAAA,MAChC,WAAW,EAAC,mCAAS,QAAO,KAAK,SAAS,sBAAsB,GAAG;AAAA,MASnE;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,kBAAkB,OAAyC;AAClE,QAAM,YAAY,KAAK,UAAU,KAAK;AACtC,SAAO,MAAM;AACf;AAEA,SAAS,gBAAgB,QAAqC;AAC5D,MAAI,MAAM;AACV,aAAW,OAAO,QAAQ;AACxB,UAAM,MAAM,OAAO,GAAG;AACtB,WAAO,GAAG,KAAK,UAAU,GAAG,CAAC,KAC3B,OAAO,QAAQ,WAAW,IAAI,GAAG,MAAM,KAAK,UAAU,GAAG,CAC3D;AAAA,EACF;AACA,SAAO,MAAM;AACf;",
|
|
5
|
+
"names": ["path"]
|
|
6
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,17 +17,28 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
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
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var createDevServer_exports = {};
|
|
20
30
|
__export(createDevServer_exports, {
|
|
21
31
|
createDevServer: () => createDevServer
|
|
22
32
|
});
|
|
23
33
|
module.exports = __toCommonJS(createDevServer_exports);
|
|
34
|
+
var import_lite = __toESM(require("mime/lite"));
|
|
24
35
|
var import_constants = require("../utils/constants");
|
|
25
36
|
var import_src = require("../vendor/repack/dev-server/src");
|
|
26
37
|
async function createDevServer(options, {
|
|
27
38
|
indexJson,
|
|
28
|
-
|
|
39
|
+
listenForHMR,
|
|
40
|
+
getIndexBundle,
|
|
41
|
+
hotUpdatedCJSFiles
|
|
29
42
|
}) {
|
|
30
43
|
const { start, stop } = await (0, import_src.createServer)({
|
|
31
44
|
options: {
|
|
@@ -40,9 +53,34 @@ async function createDevServer(options, {
|
|
|
40
53
|
// : undefined,
|
|
41
54
|
},
|
|
42
55
|
delegate: (ctx) => {
|
|
56
|
+
const platform = "ios";
|
|
57
|
+
listenForHMR((update) => {
|
|
58
|
+
ctx.notifyBuildEnd(platform);
|
|
59
|
+
ctx.broadcastToHmrClients(
|
|
60
|
+
{
|
|
61
|
+
action: "built",
|
|
62
|
+
body: createHmrBody({
|
|
63
|
+
errors: [],
|
|
64
|
+
warnings: [],
|
|
65
|
+
hash: `${Math.random()}`,
|
|
66
|
+
modules: {},
|
|
67
|
+
name: "",
|
|
68
|
+
time: 0
|
|
69
|
+
})
|
|
70
|
+
},
|
|
71
|
+
platform
|
|
72
|
+
);
|
|
73
|
+
});
|
|
43
74
|
return {
|
|
75
|
+
hotFiles: {
|
|
76
|
+
getSource: (path) => {
|
|
77
|
+
const next = hotUpdatedCJSFiles.get(path);
|
|
78
|
+
hotUpdatedCJSFiles.delete(path);
|
|
79
|
+
return next || "";
|
|
80
|
+
}
|
|
81
|
+
},
|
|
44
82
|
compiler: {
|
|
45
|
-
getAsset: async (filename,
|
|
83
|
+
getAsset: async (filename, platform2, sendProgress) => {
|
|
46
84
|
console.log("[GET] - ", filename);
|
|
47
85
|
if (filename === "index.bundle") {
|
|
48
86
|
return await getIndexBundle();
|
|
@@ -50,15 +88,14 @@ async function createDevServer(options, {
|
|
|
50
88
|
return "";
|
|
51
89
|
},
|
|
52
90
|
getMimeType: (filename) => {
|
|
53
|
-
|
|
54
|
-
return "application/javascript";
|
|
91
|
+
return import_lite.default.getType(filename) || "application/javascript";
|
|
55
92
|
},
|
|
56
93
|
inferPlatform: (uri) => {
|
|
57
94
|
return "ios";
|
|
58
95
|
const url = new URL(uri, "protocol://domain");
|
|
59
96
|
if (!url.searchParams.get("platform")) {
|
|
60
|
-
const [,
|
|
61
|
-
return
|
|
97
|
+
const [, platform2] = /^\/(.+)\/.+$/.exec(url.pathname) ?? [];
|
|
98
|
+
return platform2;
|
|
62
99
|
}
|
|
63
100
|
return void 0;
|
|
64
101
|
}
|
|
@@ -69,7 +106,6 @@ async function createDevServer(options, {
|
|
|
69
106
|
return "";
|
|
70
107
|
},
|
|
71
108
|
getSourceMap: async (fileUrl) => {
|
|
72
|
-
console.log("get source map", fileUrl);
|
|
73
109
|
return "";
|
|
74
110
|
},
|
|
75
111
|
shouldIncludeFrame: (frame) => {
|
|
@@ -77,15 +113,8 @@ async function createDevServer(options, {
|
|
|
77
113
|
}
|
|
78
114
|
},
|
|
79
115
|
hmr: {
|
|
80
|
-
getUriPath: () => "/
|
|
81
|
-
onClientConnected: (
|
|
82
|
-
console.log("client connected to hot");
|
|
83
|
-
const lastStats = {};
|
|
84
|
-
ctx.broadcastToHmrClients(
|
|
85
|
-
{ action: "sync", body: createHmrBody(lastStats) },
|
|
86
|
-
platform,
|
|
87
|
-
[clientId]
|
|
88
|
-
);
|
|
116
|
+
getUriPath: () => "/__hmr",
|
|
117
|
+
onClientConnected: (platform2, clientId) => {
|
|
89
118
|
}
|
|
90
119
|
},
|
|
91
120
|
messages: {
|
|
@@ -96,17 +125,25 @@ async function createDevServer(options, {
|
|
|
96
125
|
onMessage: (log) => {
|
|
97
126
|
const logEntry = makeLogEntryFromFastifyLog(log);
|
|
98
127
|
logEntry.issuer = "DevServer";
|
|
99
|
-
|
|
128
|
+
if (logEntry.type === "debug")
|
|
129
|
+
return;
|
|
130
|
+
console.log(
|
|
131
|
+
"[logger]",
|
|
132
|
+
logEntry.type === "info" ? "" : logEntry.type,
|
|
133
|
+
logEntry.message.map((m) => {
|
|
134
|
+
return `${m.msg}`;
|
|
135
|
+
}).join(", ")
|
|
136
|
+
);
|
|
100
137
|
}
|
|
101
138
|
},
|
|
102
139
|
api: {
|
|
103
140
|
// getPlatforms: async () => Object.keys(compiler.workers),
|
|
104
141
|
getPlatforms: async () => ["ios"],
|
|
105
|
-
getAssets: async (
|
|
106
|
-
console.log("get assets",
|
|
142
|
+
getAssets: async (platform2) => {
|
|
143
|
+
console.log("get assets", platform2);
|
|
107
144
|
return [];
|
|
108
145
|
},
|
|
109
|
-
getCompilationStats: async (
|
|
146
|
+
getCompilationStats: async (platform2) => {
|
|
110
147
|
return null;
|
|
111
148
|
}
|
|
112
149
|
}
|
|
@@ -118,25 +155,8 @@ async function createDevServer(options, {
|
|
|
118
155
|
await stop();
|
|
119
156
|
};
|
|
120
157
|
}
|
|
121
|
-
function createHmrBody(
|
|
122
|
-
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
const modules = {};
|
|
126
|
-
for (const module2 of stats.modules ?? []) {
|
|
127
|
-
const { identifier, name } = module2;
|
|
128
|
-
if (identifier !== void 0 && name) {
|
|
129
|
-
modules[identifier] = name;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return {
|
|
133
|
-
name: stats.name ?? "",
|
|
134
|
-
time: stats.time ?? 0,
|
|
135
|
-
hash: stats.hash ?? "",
|
|
136
|
-
warnings: stats.warnings || [],
|
|
137
|
-
errors: stats.errors || [],
|
|
138
|
-
modules
|
|
139
|
-
};
|
|
158
|
+
function createHmrBody(body) {
|
|
159
|
+
return body;
|
|
140
160
|
}
|
|
141
161
|
function makeLogEntryFromFastifyLog(data) {
|
|
142
162
|
const { level, time, pid, hostname, ...rest } = data;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/dev/createDevServer.ts"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": ["
|
|
4
|
+
"mappings": "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",
|
|
5
|
+
"names": ["platform", "mime"]
|
|
6
6
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
package/dist/dev.js
CHANGED
|
@@ -33,98 +33,99 @@ __export(dev_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(dev_exports);
|
|
34
34
|
var import_promises = require("fs/promises");
|
|
35
35
|
var import_path = require("path");
|
|
36
|
+
var import_vite_native_swc = __toESM(require("@tamagui/vite-native-swc"));
|
|
36
37
|
var import_vite_plugin = require("@tamagui/vite-plugin");
|
|
37
38
|
var import_chalk = __toESM(require("chalk"));
|
|
38
|
-
var import_fs_extra =
|
|
39
|
+
var import_fs_extra = require("fs-extra");
|
|
39
40
|
var import_vite = require("vite");
|
|
41
|
+
var import_clientInjectPlugin = require("./dev/clientInjectPlugin");
|
|
40
42
|
var import_createDevServer = require("./dev/createDevServer");
|
|
41
43
|
var import_utils = require("./utils");
|
|
42
44
|
const dev = async (options) => {
|
|
43
|
-
var _a;
|
|
44
45
|
const { root, mode, paths } = options;
|
|
45
|
-
|
|
46
|
+
const projectRoot = root;
|
|
46
47
|
const packageRootDir = (0, import_path.join)(__dirname, "..");
|
|
47
48
|
await (0, import_vite_plugin.nativePrebuild)();
|
|
49
|
+
const port = options.port || 8081;
|
|
48
50
|
const plugins = [
|
|
49
51
|
// tamaguiPlugin({
|
|
50
52
|
// components: ['tamagui'],
|
|
51
53
|
// target: 'native',
|
|
52
54
|
// }),
|
|
53
|
-
(0,
|
|
55
|
+
(0, import_vite_native_swc.default)({
|
|
56
|
+
tsDecorators: true
|
|
57
|
+
}),
|
|
58
|
+
(0, import_vite_plugin.nativePlugin)({
|
|
59
|
+
port
|
|
60
|
+
})
|
|
54
61
|
];
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
root
|
|
62
|
+
const hmrListeners = [];
|
|
63
|
+
const hotUpdatedCJSFiles = /* @__PURE__ */ new Map();
|
|
64
|
+
let serverConfig = {
|
|
65
|
+
root,
|
|
59
66
|
mode: "development",
|
|
60
|
-
|
|
67
|
+
clearScreen: false,
|
|
68
|
+
plugins: [
|
|
69
|
+
...plugins,
|
|
70
|
+
{
|
|
71
|
+
name: `tamagui-hot-update`,
|
|
72
|
+
async handleHotUpdate({ file, read, modules }) {
|
|
73
|
+
var _a;
|
|
74
|
+
if (!file.includes("/src/")) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const id = ((_a = modules[0]) == null ? void 0 : _a.url) || file.replace(root, "");
|
|
78
|
+
if (!id) {
|
|
79
|
+
console.log("\u26A0\uFE0F no modules?", file);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
const raw = await read();
|
|
84
|
+
const swcout = await (0, import_vite_native_swc.swcTransform)(
|
|
85
|
+
file,
|
|
86
|
+
raw,
|
|
87
|
+
{
|
|
88
|
+
tsDecorators: true
|
|
89
|
+
},
|
|
90
|
+
true
|
|
91
|
+
);
|
|
92
|
+
if (!swcout) {
|
|
93
|
+
throw "sadsad";
|
|
94
|
+
}
|
|
95
|
+
let contents = await (0, import_vite_plugin.nativeBabelTransform)(swcout.code);
|
|
96
|
+
contents = `exports = ((exports) => { ${contents}; return exports })({})`;
|
|
97
|
+
hotUpdatedCJSFiles.set(id, contents);
|
|
98
|
+
} catch (err) {
|
|
99
|
+
console.log("error hmring", err);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
],
|
|
61
104
|
server: {
|
|
105
|
+
cors: true,
|
|
62
106
|
port: options.port,
|
|
63
|
-
host: options.host || "
|
|
107
|
+
host: options.host || "127.0.0.1"
|
|
64
108
|
}
|
|
65
|
-
});
|
|
66
|
-
await server.listen();
|
|
67
|
-
await (0, import_fs_extra.ensureDir)(options.paths.dotDir);
|
|
68
|
-
const info = (_a = server.httpServer) == null ? void 0 : _a.address();
|
|
69
|
-
const port = 8081;
|
|
70
|
-
const defaultResponse = {
|
|
71
|
-
name: "myapp",
|
|
72
|
-
slug: "myapp",
|
|
73
|
-
scheme: "myapp",
|
|
74
|
-
version: "1.0.0",
|
|
75
|
-
jsEngine: "jsc",
|
|
76
|
-
orientation: "portrait",
|
|
77
|
-
icon: "./assets/icon.png",
|
|
78
|
-
userInterfaceStyle: "light",
|
|
79
|
-
splash: {
|
|
80
|
-
image: "./assets/splash.png",
|
|
81
|
-
resizeMode: "contain",
|
|
82
|
-
backgroundColor: "#ffffff",
|
|
83
|
-
imageUrl: "http://127.0.0.1:8081/assets/./assets/splash.png"
|
|
84
|
-
},
|
|
85
|
-
updates: { fallbackToCacheTimeout: 0 },
|
|
86
|
-
assetBundlePatterns: ["**/*"],
|
|
87
|
-
ios: { supportsTablet: true, bundleIdentifier: "com.natew.myapp" },
|
|
88
|
-
android: {
|
|
89
|
-
package: "com.tamagui.myapp",
|
|
90
|
-
adaptiveIcon: {
|
|
91
|
-
foregroundImage: "./assets/adaptive-icon.png",
|
|
92
|
-
backgroundColor: "#FFFFFF",
|
|
93
|
-
foregroundImageUrl: "http://127.0.0.1:8081/assets/./assets/adaptive-icon.png"
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
web: { favicon: "./assets/favicon.png" },
|
|
97
|
-
extra: { eas: { projectId: "061b4470-78c7-4d6a-b850-8167fb0a3434" } },
|
|
98
|
-
_internal: {
|
|
99
|
-
isDebug: false,
|
|
100
|
-
projectRoot: "/Users/n8/tamagui/apps/kitchen-sink",
|
|
101
|
-
dynamicConfigPath: null,
|
|
102
|
-
staticConfigPath: "/Users/n8/tamagui/apps/kitchen-sink/app.json",
|
|
103
|
-
packageJsonPath: "/Users/n8/tamagui/apps/kitchen-sink/package.json"
|
|
104
|
-
},
|
|
105
|
-
sdkVersion: "47.0.0",
|
|
106
|
-
platforms: ["ios", "android", "web"],
|
|
107
|
-
iconUrl: `http://127.0.0.1:${port}/assets/./assets/icon.png`,
|
|
108
|
-
debuggerHost: `127.0.0.1:${port}`,
|
|
109
|
-
logUrl: `http://127.0.0.1:${port}/logs`,
|
|
110
|
-
developer: { tool: "expo-cli", projectRoot: "/Users/n8/tamagui/apps/kitchen-sink" },
|
|
111
|
-
packagerOpts: { dev: true },
|
|
112
|
-
mainModuleName: "index",
|
|
113
|
-
__flipperHack: "React Native packager is running",
|
|
114
|
-
hostUri: `127.0.0.1:${port}`,
|
|
115
|
-
bundleUrl: `http://127.0.0.1:${port}/index.bundle?platform=ios&dev=true&hot=false&lazy=true`,
|
|
116
|
-
id: "@anonymous/myapp-473c4543-3c36-4786-9db1-c66a62ac9b78"
|
|
117
109
|
};
|
|
118
|
-
const
|
|
110
|
+
const resolvedConfig = await (0, import_vite.resolveConfig)(serverConfig, "serve");
|
|
111
|
+
const viteRNClient = (0, import_clientInjectPlugin.clientInjectionsPlugin)(resolvedConfig);
|
|
112
|
+
plugins.push(viteRNClient);
|
|
113
|
+
serverConfig = {
|
|
114
|
+
...serverConfig,
|
|
115
|
+
plugins: [...serverConfig.plugins]
|
|
116
|
+
};
|
|
117
|
+
const server = await (0, import_vite.createServer)(serverConfig);
|
|
118
|
+
await server.listen();
|
|
119
119
|
const dispose = await (0, import_createDevServer.createDevServer)(options, {
|
|
120
|
+
hotUpdatedCJSFiles,
|
|
121
|
+
listenForHMR(cb) {
|
|
122
|
+
hmrListeners.push(cb);
|
|
123
|
+
},
|
|
120
124
|
getIndexBundle: async function getBundle() {
|
|
121
125
|
const outputCode = await getBundleCode();
|
|
122
|
-
setTimeout(() => {
|
|
123
|
-
import_fs_extra.default.writeFile(outputJsPath, outputCode);
|
|
124
|
-
});
|
|
125
126
|
return outputCode;
|
|
126
127
|
},
|
|
127
|
-
indexJson:
|
|
128
|
+
indexJson: getIndexJsonReponse({ port, root })
|
|
128
129
|
});
|
|
129
130
|
console.log(`Listening on:`, import_chalk.default.green(`http://localhost:${port}`));
|
|
130
131
|
server.printUrls();
|
|
@@ -133,13 +134,16 @@ const dev = async (options) => {
|
|
|
133
134
|
server.close();
|
|
134
135
|
});
|
|
135
136
|
await new Promise((res) => {
|
|
136
|
-
var
|
|
137
|
-
return (
|
|
137
|
+
var _a;
|
|
138
|
+
return (_a = server.httpServer) == null ? void 0 : _a.on("close", res);
|
|
138
139
|
});
|
|
139
140
|
async function getBundleCode() {
|
|
140
|
-
const tmpBundle = (0, import_path.join)(
|
|
141
|
+
const tmpBundle = (0, import_path.join)(process.cwd(), "bundle.tmp.js");
|
|
141
142
|
if (await (0, import_fs_extra.pathExists)(tmpBundle)) {
|
|
142
|
-
console.log(
|
|
143
|
+
console.log(
|
|
144
|
+
"\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F returning temp bundle \u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F\u26A0\uFE0F",
|
|
145
|
+
tmpBundle
|
|
146
|
+
);
|
|
143
147
|
return await (0, import_promises.readFile)(tmpBundle, "utf-8");
|
|
144
148
|
}
|
|
145
149
|
const buildOutput = await (0, import_vite.build)({
|
|
@@ -147,12 +151,9 @@ const dev = async (options) => {
|
|
|
147
151
|
plugins,
|
|
148
152
|
appType: "custom",
|
|
149
153
|
root,
|
|
154
|
+
clearScreen: false,
|
|
150
155
|
build: {
|
|
151
|
-
ssr:
|
|
152
|
-
},
|
|
153
|
-
ssr: {
|
|
154
|
-
format: "cjs",
|
|
155
|
-
target: "node"
|
|
156
|
+
ssr: false
|
|
156
157
|
},
|
|
157
158
|
mode: "development",
|
|
158
159
|
define: {
|
|
@@ -160,15 +161,19 @@ const dev = async (options) => {
|
|
|
160
161
|
"process.env.NODE_ENV": `"development"`
|
|
161
162
|
}
|
|
162
163
|
});
|
|
163
|
-
const
|
|
164
|
-
if (!
|
|
164
|
+
const appCodeIn = "output" in buildOutput ? buildOutput.output[0].code : null;
|
|
165
|
+
if (!appCodeIn) {
|
|
165
166
|
throw `\u274C`;
|
|
166
167
|
}
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
(0,
|
|
170
|
-
(0,
|
|
171
|
-
|
|
168
|
+
const appCode = await (0, import_vite_plugin.nativeBabelTransform)(appCodeIn);
|
|
169
|
+
const paths2 = [
|
|
170
|
+
(0, import_path.join)(process.cwd(), "testing-area", "react.js"),
|
|
171
|
+
(0, import_path.join)(process.cwd(), "testing-area", "react-jsx-runtime.js"),
|
|
172
|
+
(0, import_path.join)(process.cwd(), "testing-area", "react-native.js")
|
|
173
|
+
];
|
|
174
|
+
const [react, reactJsxRuntime, reactNative] = await Promise.all(
|
|
175
|
+
paths2.map((p) => (0, import_promises.readFile)(p, "utf-8"))
|
|
176
|
+
);
|
|
172
177
|
const reactCode = react.replace(
|
|
173
178
|
`module.exports = require_react_development();`,
|
|
174
179
|
`return require_react_development()`
|
|
@@ -176,18 +181,70 @@ const dev = async (options) => {
|
|
|
176
181
|
const reactJSXRuntimeCode = reactJsxRuntime.replace(
|
|
177
182
|
`module.exports = require_react_jsx_runtime_production_min();`,
|
|
178
183
|
`return require_react_jsx_runtime_production_min()`
|
|
184
|
+
// `module.exports = require_react_jsx_dev_runtime_development();`,
|
|
185
|
+
// `return require_react_jsx_dev_runtime_development();`
|
|
179
186
|
);
|
|
180
187
|
const reactNativeCode = reactNative.replace(
|
|
181
188
|
`module.exports = require_react_native();`,
|
|
182
|
-
`return require_react_native()`
|
|
189
|
+
`require_ReactNative(); return require_react_native()`
|
|
183
190
|
).replace(
|
|
184
|
-
`
|
|
185
|
-
|
|
191
|
+
`ReactRefreshRuntime.injectIntoGlobalHook(global);`,
|
|
192
|
+
`globalThis['_ReactRefreshRuntime'] = ReactRefreshRuntime; ReactRefreshRuntime.injectIntoGlobalHook(global);`
|
|
186
193
|
);
|
|
187
194
|
const templateFile = (0, import_path.join)(packageRootDir, "react-native-template.js");
|
|
188
|
-
return (await (0, import_promises.readFile)(templateFile, "utf-8")).replace(`// -- react --`, reactCode).replace(`// -- react-native --`, reactNativeCode).replace(`// -- react/jsx-runtime --`, reactJSXRuntimeCode).replace(`// -- app --`, appCode);
|
|
195
|
+
return (await (0, import_promises.readFile)(templateFile, "utf-8")).replace(`// -- react --`, reactCode).replace(`// -- react-native --`, reactNativeCode).replace(`// -- react/jsx-runtime --`, reactJSXRuntimeCode).replace(`// -- app --`, appCode.replace('"use strict";', ""));
|
|
189
196
|
}
|
|
190
197
|
};
|
|
198
|
+
function getIndexJsonReponse({ port, root }) {
|
|
199
|
+
return {
|
|
200
|
+
name: "myapp",
|
|
201
|
+
slug: "myapp",
|
|
202
|
+
scheme: "myapp",
|
|
203
|
+
version: "1.0.0",
|
|
204
|
+
jsEngine: "jsc",
|
|
205
|
+
orientation: "portrait",
|
|
206
|
+
icon: "./assets/icon.png",
|
|
207
|
+
userInterfaceStyle: "light",
|
|
208
|
+
splash: {
|
|
209
|
+
image: "./assets/splash.png",
|
|
210
|
+
resizeMode: "contain",
|
|
211
|
+
backgroundColor: "#ffffff",
|
|
212
|
+
imageUrl: "http://127.0.0.1:8081/assets/./assets/splash.png"
|
|
213
|
+
},
|
|
214
|
+
updates: { fallbackToCacheTimeout: 0 },
|
|
215
|
+
assetBundlePatterns: ["**/*"],
|
|
216
|
+
ios: { supportsTablet: true, bundleIdentifier: "com.natew.myapp" },
|
|
217
|
+
android: {
|
|
218
|
+
package: "com.tamagui.myapp",
|
|
219
|
+
adaptiveIcon: {
|
|
220
|
+
foregroundImage: "./assets/adaptive-icon.png",
|
|
221
|
+
backgroundColor: "#FFFFFF",
|
|
222
|
+
foregroundImageUrl: "http://127.0.0.1:8081/assets/./assets/adaptive-icon.png"
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
web: { favicon: "./assets/favicon.png" },
|
|
226
|
+
extra: { eas: { projectId: "061b4470-78c7-4d6a-b850-8167fb0a3434" } },
|
|
227
|
+
_internal: {
|
|
228
|
+
isDebug: false,
|
|
229
|
+
projectRoot: root,
|
|
230
|
+
dynamicConfigPath: null,
|
|
231
|
+
staticConfigPath: (0, import_path.join)(root, "app.json"),
|
|
232
|
+
packageJsonPath: (0, import_path.join)(root, "package.json")
|
|
233
|
+
},
|
|
234
|
+
sdkVersion: "47.0.0",
|
|
235
|
+
platforms: ["ios", "android", "web"],
|
|
236
|
+
iconUrl: `http://127.0.0.1:${port}/assets/./assets/icon.png`,
|
|
237
|
+
debuggerHost: `127.0.0.1:${port}`,
|
|
238
|
+
logUrl: `http://127.0.0.1:${port}/logs`,
|
|
239
|
+
developer: { tool: "expo-cli", projectRoot: root },
|
|
240
|
+
packagerOpts: { dev: true },
|
|
241
|
+
mainModuleName: "index",
|
|
242
|
+
__flipperHack: "React Native packager is running",
|
|
243
|
+
hostUri: `127.0.0.1:${port}`,
|
|
244
|
+
bundleUrl: `http://127.0.0.1:${port}/index.bundle?platform=ios&dev=true&hot=false&lazy=true`,
|
|
245
|
+
id: "@anonymous/myapp-473c4543-3c36-4786-9db1-c66a62ac9b78"
|
|
246
|
+
};
|
|
247
|
+
}
|
|
191
248
|
// Annotate the CommonJS export names for ESM import in node:
|
|
192
249
|
0 && (module.exports = {
|
|
193
250
|
dev
|