@rozenite/vite-plugin 2.0.0 → 2.2.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/bundle-dts.d.ts.map +1 -1
- package/dist/client-plugin.d.ts.map +1 -1
- package/dist/dev-config-module.d.ts.map +1 -1
- package/dist/dev-host/assets/index-B0yO0ie2.css +1 -0
- package/dist/dev-host/assets/index-zhOD0ia6.js +13 -0
- package/dist/dev-host/index.html +2 -2
- package/dist/dev-host/manifest.json +2 -2
- package/dist/index.cjs +21 -66
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -66
- package/dist/load-config.d.ts.map +1 -1
- package/dist/package-json.d.ts.map +1 -1
- package/dist/react-native-plugin.d.ts.map +1 -1
- package/dist/require-plugin.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/package.json +25 -25
- package/src/bundle-dts.ts +3 -12
- package/src/client-plugin.ts +9 -34
- package/src/dev-config-module.ts +1 -4
- package/src/dev-host/App.tsx +20 -56
- package/src/dev-host/components/DispatchForm.tsx +11 -28
- package/src/dev-host/components/FlowList.tsx +14 -12
- package/src/dev-host/components/MessageDetailsPane.tsx +12 -20
- package/src/dev-host/components/MessageLogPane.tsx +9 -19
- package/src/dev-host/components/PanelTabs.tsx +3 -13
- package/src/dev-host/config.ts +2 -6
- package/src/dev-host/flow-runtime.ts +6 -24
- package/src/dev-host/server.ts +3 -9
- package/src/dev-host/styles.css +2 -2
- package/src/dev-host/types.ts +1 -5
- package/src/dev-host/utils.ts +3 -12
- package/src/index.ts +4 -14
- package/src/load-config.ts +9 -20
- package/src/package-json.ts +1 -3
- package/src/react-native-plugin.ts +1 -2
- package/src/require-plugin.ts +6 -18
- package/src/utils.ts +1 -4
- package/dist/dev-host/assets/index-DU3zXL2c.css +0 -1
- package/dist/dev-host/assets/index-Xsb6uYhI.js +0 -13
package/dist/dev-host/index.html
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Rozenite Dev Host</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/index-
|
|
8
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
7
|
+
<script type="module" crossorigin src="./assets/index-zhOD0ia6.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="./assets/index-B0yO0ie2.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div id="root"></div>
|
package/dist/index.cjs
CHANGED
|
@@ -53,19 +53,12 @@ const loadConfig = async (configPath) => {
|
|
|
53
53
|
throw new Error(`Configuration file not found: ${absoluteConfigPath}`);
|
|
54
54
|
}
|
|
55
55
|
try {
|
|
56
|
-
const configContent = await fs.promises.readFile(
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
absoluteConfigPath,
|
|
63
|
-
{
|
|
64
|
-
loader: "ts",
|
|
65
|
-
format: "cjs",
|
|
66
|
-
target: "esnext"
|
|
67
|
-
}
|
|
68
|
-
);
|
|
56
|
+
const configContent = await fs.promises.readFile(absoluteConfigPath, "utf-8");
|
|
57
|
+
const result = await vite.transformWithEsbuild(configContent, absoluteConfigPath, {
|
|
58
|
+
loader: "ts",
|
|
59
|
+
format: "cjs",
|
|
60
|
+
target: "esnext"
|
|
61
|
+
});
|
|
69
62
|
const moduleExports = {};
|
|
70
63
|
const module2 = { exports: moduleExports };
|
|
71
64
|
const exports2 = moduleExports;
|
|
@@ -79,9 +72,7 @@ const loadConfig = async (configPath) => {
|
|
|
79
72
|
return config;
|
|
80
73
|
} catch (error) {
|
|
81
74
|
if (error instanceof Error) {
|
|
82
|
-
throw new Error(
|
|
83
|
-
`Failed to load configuration from ${configPath}: ${error.message}`
|
|
84
|
-
);
|
|
75
|
+
throw new Error(`Failed to load configuration from ${configPath}: ${error.message}`);
|
|
85
76
|
}
|
|
86
77
|
throw new Error(`Failed to load configuration from ${configPath}`);
|
|
87
78
|
}
|
|
@@ -116,14 +107,10 @@ const getBuiltDevHostAssets = (packageDir) => {
|
|
|
116
107
|
if (!fs.existsSync(manifestPath)) {
|
|
117
108
|
return null;
|
|
118
109
|
}
|
|
119
|
-
const manifest = JSON.parse(
|
|
120
|
-
fs.readFileSync(manifestPath, "utf8")
|
|
121
|
-
);
|
|
110
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
|
122
111
|
const entry = manifest[DEV_HOST_BUILD_ENTRY_KEY];
|
|
123
112
|
if (!entry?.file) {
|
|
124
|
-
throw new Error(
|
|
125
|
-
`Missing ${DEV_HOST_BUILD_ENTRY_KEY} entry in dev host manifest.`
|
|
126
|
-
);
|
|
113
|
+
throw new Error(`Missing ${DEV_HOST_BUILD_ENTRY_KEY} entry in dev host manifest.`);
|
|
127
114
|
}
|
|
128
115
|
return {
|
|
129
116
|
script: path.join(devHostDistDir, entry.file),
|
|
@@ -149,12 +136,7 @@ const loadRozeniteDevConfigModule = (id, projectRoot) => {
|
|
|
149
136
|
const configPath = vite.normalizePath(getRozeniteConfigPath(projectRoot));
|
|
150
137
|
return `export { default } from ${JSON.stringify(`/@fs${configPath}`)};`;
|
|
151
138
|
};
|
|
152
|
-
const TEMPLATES_DIR = path.resolve(
|
|
153
|
-
node_url.fileURLToPath(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href),
|
|
154
|
-
"..",
|
|
155
|
-
"..",
|
|
156
|
-
"templates"
|
|
157
|
-
);
|
|
139
|
+
const TEMPLATES_DIR = path.resolve(node_url.fileURLToPath(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href), "..", "..", "templates");
|
|
158
140
|
const PACKAGE_DIR = path.resolve(node_url.fileURLToPath(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index.cjs", document.baseURI).href), "..", "..");
|
|
159
141
|
const DEV_HOST_SOURCE_ENTRY_FILE = getDevHostSourceEntryFile(PACKAGE_DIR);
|
|
160
142
|
const PANELS_DIR = "./panels";
|
|
@@ -268,10 +250,7 @@ const rozeniteClientPlugin = () => {
|
|
|
268
250
|
config.build.rollupOptions.input = {
|
|
269
251
|
...config.build.rollupOptions.input,
|
|
270
252
|
...Object.fromEntries(
|
|
271
|
-
panels.map((panel) => [
|
|
272
|
-
panel.name,
|
|
273
|
-
`${DEVTOOLS_DIR}/${panel.htmlFile}`
|
|
274
|
-
])
|
|
253
|
+
panels.map((panel) => [panel.name, `${DEVTOOLS_DIR}/${panel.htmlFile}`])
|
|
275
254
|
)
|
|
276
255
|
};
|
|
277
256
|
config.build.rollupOptions.output = {
|
|
@@ -286,9 +265,7 @@ const rozeniteClientPlugin = () => {
|
|
|
286
265
|
if (devConfigModuleId) {
|
|
287
266
|
return devConfigModuleId;
|
|
288
267
|
}
|
|
289
|
-
const isPanel = getPanels().some(
|
|
290
|
-
(panel) => `${DEVTOOLS_DIR}/${panel.htmlFile}` === id
|
|
291
|
-
);
|
|
268
|
+
const isPanel = getPanels().some((panel) => `${DEVTOOLS_DIR}/${panel.htmlFile}` === id);
|
|
292
269
|
if (isPanel) {
|
|
293
270
|
return id;
|
|
294
271
|
}
|
|
@@ -299,9 +276,7 @@ const rozeniteClientPlugin = () => {
|
|
|
299
276
|
if (devConfigModule) {
|
|
300
277
|
return devConfigModule;
|
|
301
278
|
}
|
|
302
|
-
const panel = getPanels().find(
|
|
303
|
-
(panel2) => `${DEVTOOLS_DIR}/${panel2.htmlFile}` === id
|
|
304
|
-
);
|
|
279
|
+
const panel = getPanels().find((panel2) => `${DEVTOOLS_DIR}/${panel2.htmlFile}` === id);
|
|
305
280
|
if (panel) {
|
|
306
281
|
return generatePanelHtmlContent(panel);
|
|
307
282
|
}
|
|
@@ -347,14 +322,8 @@ const rozeniteClientPlugin = () => {
|
|
|
347
322
|
const packageJSON = await getPackageJSON(projectRoot);
|
|
348
323
|
server.middlewares.use((req, res, next) => {
|
|
349
324
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
350
|
-
res.setHeader(
|
|
351
|
-
|
|
352
|
-
"GET, POST, PUT, DELETE, OPTIONS"
|
|
353
|
-
);
|
|
354
|
-
res.setHeader(
|
|
355
|
-
"Access-Control-Allow-Headers",
|
|
356
|
-
"Content-Type, Authorization"
|
|
357
|
-
);
|
|
325
|
+
res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
|
|
326
|
+
res.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization");
|
|
358
327
|
if (req.method === "OPTIONS") {
|
|
359
328
|
res.statusCode = 200;
|
|
360
329
|
res.end();
|
|
@@ -388,9 +357,7 @@ const rozeniteClientPlugin = () => {
|
|
|
388
357
|
);
|
|
389
358
|
return;
|
|
390
359
|
}
|
|
391
|
-
const panel = panels.find(
|
|
392
|
-
(panel2) => `/${DEVTOOLS_DIR}/` + panel2.htmlFile === url
|
|
393
|
-
);
|
|
360
|
+
const panel = panels.find((panel2) => `/${DEVTOOLS_DIR}/` + panel2.htmlFile === url);
|
|
394
361
|
if (panel) {
|
|
395
362
|
const htmlContent = generatePanelHtmlContent(panel);
|
|
396
363
|
server.transformIndexHtml(requestUrl, htmlContent).then((html) => {
|
|
@@ -566,9 +533,7 @@ const transformRequireToChunkReferences = (code, moduleInfoMap, getFileName) =>
|
|
|
566
533
|
return match;
|
|
567
534
|
}
|
|
568
535
|
const outFileName = getFileName(moduleInfo.referenceId);
|
|
569
|
-
const relPath = vite.normalizePath(
|
|
570
|
-
path.posix.relative("react-native", outFileName)
|
|
571
|
-
);
|
|
536
|
+
const relPath = vite.normalizePath(path.posix.relative("react-native", outFileName));
|
|
572
537
|
const requirePath = relPath.startsWith(".") ? relPath : `./${relPath}`;
|
|
573
538
|
return `require('${requirePath}')`;
|
|
574
539
|
});
|
|
@@ -611,10 +576,7 @@ function requirePlugin() {
|
|
|
611
576
|
async buildStart(options) {
|
|
612
577
|
try {
|
|
613
578
|
assert(Array.isArray(options.input), "input must be an array");
|
|
614
|
-
assert(
|
|
615
|
-
options.input.length === 1,
|
|
616
|
-
"input must be an array with one entry"
|
|
617
|
-
);
|
|
579
|
+
assert(options.input.length === 1, "input must be an array with one entry");
|
|
618
580
|
input = options.input[0];
|
|
619
581
|
inputName = extractModuleName(input);
|
|
620
582
|
moduleInfoMap.clear();
|
|
@@ -629,15 +591,10 @@ function requirePlugin() {
|
|
|
629
591
|
continue;
|
|
630
592
|
}
|
|
631
593
|
this.addWatchFile(resolved.id);
|
|
632
|
-
const exportName = sanitizeChunkName(
|
|
633
|
-
extractModuleName(resolved.id)
|
|
634
|
-
);
|
|
594
|
+
const exportName = sanitizeChunkName(extractModuleName(resolved.id));
|
|
635
595
|
const wrapperName = `${exportName}${REQUIRE_WRAPPER_SUFFIX}`;
|
|
636
596
|
const virtualId = `${VIRTUAL_REQUIRE_PREFIX}${wrapperName}`;
|
|
637
|
-
virtualModuleSources.set(
|
|
638
|
-
virtualId,
|
|
639
|
-
`export * from ${JSON.stringify(req)};`
|
|
640
|
-
);
|
|
597
|
+
virtualModuleSources.set(virtualId, `export * from ${JSON.stringify(req)};`);
|
|
641
598
|
const referenceId = this.emitFile({
|
|
642
599
|
type: "chunk",
|
|
643
600
|
id: virtualId,
|
|
@@ -822,9 +779,7 @@ const getDtsPlugin = (target) => {
|
|
|
822
779
|
}
|
|
823
780
|
});
|
|
824
781
|
};
|
|
825
|
-
const rozenitePlugin = ({
|
|
826
|
-
tailwind = true
|
|
827
|
-
} = {}) => {
|
|
782
|
+
const rozenitePlugin = ({ tailwind = true } = {}) => {
|
|
828
783
|
const isServer = process.env.VITE_ROZENITE_TARGET === "server";
|
|
829
784
|
const isReactNative = process.env.VITE_ROZENITE_TARGET === "react-native";
|
|
830
785
|
const isSdk = process.env.VITE_ROZENITE_TARGET === "sdk";
|
package/dist/index.d.ts
CHANGED
|
@@ -7,5 +7,5 @@ export type RozenitePluginOptions = {
|
|
|
7
7
|
*/
|
|
8
8
|
tailwind?: boolean;
|
|
9
9
|
};
|
|
10
|
-
export declare const rozenitePlugin: ({ tailwind
|
|
10
|
+
export declare const rozenitePlugin: ({ tailwind }?: RozenitePluginOptions) => PluginOption[];
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AA+EzC,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,eAAqB,qBAA0B,KAAG,YAAY,EAyB5F,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -50,19 +50,12 @@ const loadConfig = async (configPath) => {
|
|
|
50
50
|
throw new Error(`Configuration file not found: ${absoluteConfigPath}`);
|
|
51
51
|
}
|
|
52
52
|
try {
|
|
53
|
-
const configContent = await fs.promises.readFile(
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
absoluteConfigPath,
|
|
60
|
-
{
|
|
61
|
-
loader: "ts",
|
|
62
|
-
format: "cjs",
|
|
63
|
-
target: "esnext"
|
|
64
|
-
}
|
|
65
|
-
);
|
|
53
|
+
const configContent = await fs.promises.readFile(absoluteConfigPath, "utf-8");
|
|
54
|
+
const result = await transformWithEsbuild(configContent, absoluteConfigPath, {
|
|
55
|
+
loader: "ts",
|
|
56
|
+
format: "cjs",
|
|
57
|
+
target: "esnext"
|
|
58
|
+
});
|
|
66
59
|
const moduleExports = {};
|
|
67
60
|
const module = { exports: moduleExports };
|
|
68
61
|
const exports = moduleExports;
|
|
@@ -76,9 +69,7 @@ const loadConfig = async (configPath) => {
|
|
|
76
69
|
return config;
|
|
77
70
|
} catch (error) {
|
|
78
71
|
if (error instanceof Error) {
|
|
79
|
-
throw new Error(
|
|
80
|
-
`Failed to load configuration from ${configPath}: ${error.message}`
|
|
81
|
-
);
|
|
72
|
+
throw new Error(`Failed to load configuration from ${configPath}: ${error.message}`);
|
|
82
73
|
}
|
|
83
74
|
throw new Error(`Failed to load configuration from ${configPath}`);
|
|
84
75
|
}
|
|
@@ -113,14 +104,10 @@ const getBuiltDevHostAssets = (packageDir) => {
|
|
|
113
104
|
if (!fs.existsSync(manifestPath)) {
|
|
114
105
|
return null;
|
|
115
106
|
}
|
|
116
|
-
const manifest = JSON.parse(
|
|
117
|
-
fs.readFileSync(manifestPath, "utf8")
|
|
118
|
-
);
|
|
107
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
|
119
108
|
const entry = manifest[DEV_HOST_BUILD_ENTRY_KEY];
|
|
120
109
|
if (!entry?.file) {
|
|
121
|
-
throw new Error(
|
|
122
|
-
`Missing ${DEV_HOST_BUILD_ENTRY_KEY} entry in dev host manifest.`
|
|
123
|
-
);
|
|
110
|
+
throw new Error(`Missing ${DEV_HOST_BUILD_ENTRY_KEY} entry in dev host manifest.`);
|
|
124
111
|
}
|
|
125
112
|
return {
|
|
126
113
|
script: path.join(devHostDistDir, entry.file),
|
|
@@ -146,12 +133,7 @@ const loadRozeniteDevConfigModule = (id, projectRoot) => {
|
|
|
146
133
|
const configPath = normalizePath(getRozeniteConfigPath(projectRoot));
|
|
147
134
|
return `export { default } from ${JSON.stringify(`/@fs${configPath}`)};`;
|
|
148
135
|
};
|
|
149
|
-
const TEMPLATES_DIR = path.resolve(
|
|
150
|
-
fileURLToPath(import.meta.url),
|
|
151
|
-
"..",
|
|
152
|
-
"..",
|
|
153
|
-
"templates"
|
|
154
|
-
);
|
|
136
|
+
const TEMPLATES_DIR = path.resolve(fileURLToPath(import.meta.url), "..", "..", "templates");
|
|
155
137
|
const PACKAGE_DIR = path.resolve(fileURLToPath(import.meta.url), "..", "..");
|
|
156
138
|
const DEV_HOST_SOURCE_ENTRY_FILE = getDevHostSourceEntryFile(PACKAGE_DIR);
|
|
157
139
|
const PANELS_DIR = "./panels";
|
|
@@ -265,10 +247,7 @@ const rozeniteClientPlugin = () => {
|
|
|
265
247
|
config.build.rollupOptions.input = {
|
|
266
248
|
...config.build.rollupOptions.input,
|
|
267
249
|
...Object.fromEntries(
|
|
268
|
-
panels.map((panel) => [
|
|
269
|
-
panel.name,
|
|
270
|
-
`${DEVTOOLS_DIR}/${panel.htmlFile}`
|
|
271
|
-
])
|
|
250
|
+
panels.map((panel) => [panel.name, `${DEVTOOLS_DIR}/${panel.htmlFile}`])
|
|
272
251
|
)
|
|
273
252
|
};
|
|
274
253
|
config.build.rollupOptions.output = {
|
|
@@ -283,9 +262,7 @@ const rozeniteClientPlugin = () => {
|
|
|
283
262
|
if (devConfigModuleId) {
|
|
284
263
|
return devConfigModuleId;
|
|
285
264
|
}
|
|
286
|
-
const isPanel = getPanels().some(
|
|
287
|
-
(panel) => `${DEVTOOLS_DIR}/${panel.htmlFile}` === id
|
|
288
|
-
);
|
|
265
|
+
const isPanel = getPanels().some((panel) => `${DEVTOOLS_DIR}/${panel.htmlFile}` === id);
|
|
289
266
|
if (isPanel) {
|
|
290
267
|
return id;
|
|
291
268
|
}
|
|
@@ -296,9 +273,7 @@ const rozeniteClientPlugin = () => {
|
|
|
296
273
|
if (devConfigModule) {
|
|
297
274
|
return devConfigModule;
|
|
298
275
|
}
|
|
299
|
-
const panel = getPanels().find(
|
|
300
|
-
(panel2) => `${DEVTOOLS_DIR}/${panel2.htmlFile}` === id
|
|
301
|
-
);
|
|
276
|
+
const panel = getPanels().find((panel2) => `${DEVTOOLS_DIR}/${panel2.htmlFile}` === id);
|
|
302
277
|
if (panel) {
|
|
303
278
|
return generatePanelHtmlContent(panel);
|
|
304
279
|
}
|
|
@@ -344,14 +319,8 @@ const rozeniteClientPlugin = () => {
|
|
|
344
319
|
const packageJSON = await getPackageJSON(projectRoot);
|
|
345
320
|
server.middlewares.use((req, res, next) => {
|
|
346
321
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
347
|
-
res.setHeader(
|
|
348
|
-
|
|
349
|
-
"GET, POST, PUT, DELETE, OPTIONS"
|
|
350
|
-
);
|
|
351
|
-
res.setHeader(
|
|
352
|
-
"Access-Control-Allow-Headers",
|
|
353
|
-
"Content-Type, Authorization"
|
|
354
|
-
);
|
|
322
|
+
res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
|
|
323
|
+
res.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization");
|
|
355
324
|
if (req.method === "OPTIONS") {
|
|
356
325
|
res.statusCode = 200;
|
|
357
326
|
res.end();
|
|
@@ -385,9 +354,7 @@ const rozeniteClientPlugin = () => {
|
|
|
385
354
|
);
|
|
386
355
|
return;
|
|
387
356
|
}
|
|
388
|
-
const panel = panels.find(
|
|
389
|
-
(panel2) => `/${DEVTOOLS_DIR}/` + panel2.htmlFile === url
|
|
390
|
-
);
|
|
357
|
+
const panel = panels.find((panel2) => `/${DEVTOOLS_DIR}/` + panel2.htmlFile === url);
|
|
391
358
|
if (panel) {
|
|
392
359
|
const htmlContent = generatePanelHtmlContent(panel);
|
|
393
360
|
server.transformIndexHtml(requestUrl, htmlContent).then((html) => {
|
|
@@ -563,9 +530,7 @@ const transformRequireToChunkReferences = (code, moduleInfoMap, getFileName) =>
|
|
|
563
530
|
return match;
|
|
564
531
|
}
|
|
565
532
|
const outFileName = getFileName(moduleInfo.referenceId);
|
|
566
|
-
const relPath = normalizePath(
|
|
567
|
-
path.posix.relative("react-native", outFileName)
|
|
568
|
-
);
|
|
533
|
+
const relPath = normalizePath(path.posix.relative("react-native", outFileName));
|
|
569
534
|
const requirePath = relPath.startsWith(".") ? relPath : `./${relPath}`;
|
|
570
535
|
return `require('${requirePath}')`;
|
|
571
536
|
});
|
|
@@ -608,10 +573,7 @@ function requirePlugin() {
|
|
|
608
573
|
async buildStart(options) {
|
|
609
574
|
try {
|
|
610
575
|
assert(Array.isArray(options.input), "input must be an array");
|
|
611
|
-
assert(
|
|
612
|
-
options.input.length === 1,
|
|
613
|
-
"input must be an array with one entry"
|
|
614
|
-
);
|
|
576
|
+
assert(options.input.length === 1, "input must be an array with one entry");
|
|
615
577
|
input = options.input[0];
|
|
616
578
|
inputName = extractModuleName(input);
|
|
617
579
|
moduleInfoMap.clear();
|
|
@@ -626,15 +588,10 @@ function requirePlugin() {
|
|
|
626
588
|
continue;
|
|
627
589
|
}
|
|
628
590
|
this.addWatchFile(resolved.id);
|
|
629
|
-
const exportName = sanitizeChunkName(
|
|
630
|
-
extractModuleName(resolved.id)
|
|
631
|
-
);
|
|
591
|
+
const exportName = sanitizeChunkName(extractModuleName(resolved.id));
|
|
632
592
|
const wrapperName = `${exportName}${REQUIRE_WRAPPER_SUFFIX}`;
|
|
633
593
|
const virtualId = `${VIRTUAL_REQUIRE_PREFIX}${wrapperName}`;
|
|
634
|
-
virtualModuleSources.set(
|
|
635
|
-
virtualId,
|
|
636
|
-
`export * from ${JSON.stringify(req)};`
|
|
637
|
-
);
|
|
594
|
+
virtualModuleSources.set(virtualId, `export * from ${JSON.stringify(req)};`);
|
|
638
595
|
const referenceId = this.emitFile({
|
|
639
596
|
type: "chunk",
|
|
640
597
|
id: virtualId,
|
|
@@ -819,9 +776,7 @@ const getDtsPlugin = (target) => {
|
|
|
819
776
|
}
|
|
820
777
|
});
|
|
821
778
|
};
|
|
822
|
-
const rozenitePlugin = ({
|
|
823
|
-
tailwind = true
|
|
824
|
-
} = {}) => {
|
|
779
|
+
const rozenitePlugin = ({ tailwind = true } = {}) => {
|
|
825
780
|
const isServer = process.env.VITE_ROZENITE_TARGET === "server";
|
|
826
781
|
const isReactNative = process.env.VITE_ROZENITE_TARGET === "react-native";
|
|
827
782
|
const isSdk = process.env.VITE_ROZENITE_TARGET === "sdk";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-config.d.ts","sourceRoot":"","sources":["../src/load-config.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,IAAI,GAAG,KAAK,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAC7B,MAAM,GACN,CAAC,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,GACtC;IACE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;IACxC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC;CAClD,CAAC;AAEN,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,cAAc,GA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AAO,CAAC,OAAO,CAAC,CAAC;CAC9D,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,UAAU,GAAU,YAAY,MAAM,KAAG,OAAO,CAAC,cAAc,CAqC3E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-json.d.ts","sourceRoot":"","sources":["../src/package-json.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"package-json.d.ts","sourceRoot":"","sources":["../src/package-json.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAU,aAAa,MAAM,KAAG,OAAO,CAAC,WAAW,CAI7E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-native-plugin.d.ts","sourceRoot":"","sources":["../src/react-native-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAG9B,eAAO,MAAM,yBAAyB,QAAO,
|
|
1
|
+
{"version":3,"file":"react-native-plugin.d.ts","sourceRoot":"","sources":["../src/react-native-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAG9B,eAAO,MAAM,yBAAyB,QAAO,MA+C5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-plugin.d.ts","sourceRoot":"","sources":["../src/require-plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,MAAM,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"require-plugin.d.ts","sourceRoot":"","sources":["../src/require-plugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAiB,MAAM,EAAE,MAAM,MAAM,CAAC;AA4F7C,MAAM,CAAC,OAAO,UAAU,aAAa,IAAI,MAAM,CAiH9C"}
|