minista 2.4.2 → 2.4.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/build.d.ts +0 -2
- package/dist/build.js +15 -17
- package/dist/esbuild.js +1 -1
- package/dist/generate.js +1 -3
- package/package.json +1 -1
package/dist/build.d.ts
CHANGED
|
@@ -25,7 +25,6 @@ export declare function buildTempAssets(viteConfig: InlineConfig, buildOptions:
|
|
|
25
25
|
bundleOutName: string;
|
|
26
26
|
outDir: string;
|
|
27
27
|
assetDir: string;
|
|
28
|
-
generateJs: boolean;
|
|
29
28
|
}): Promise<void>;
|
|
30
29
|
export declare function buildAssetsTagStr(entryPoints: string[], buildOptions: {
|
|
31
30
|
outBase: string;
|
|
@@ -57,7 +56,6 @@ export declare function buildPartialHydrateAssets(viteConfig: InlineConfig, buil
|
|
|
57
56
|
bundleOutName: string;
|
|
58
57
|
outDir: string;
|
|
59
58
|
assetDir: string;
|
|
60
|
-
generateJs: boolean;
|
|
61
59
|
usePreact: boolean;
|
|
62
60
|
}): Promise<void>;
|
|
63
61
|
export declare function buildCopyDir(targetDir: string, outDir: string, log?: "public" | "assets"): Promise<void>;
|
package/dist/build.js
CHANGED
|
@@ -42,16 +42,22 @@ import { renderHtml } from "./render.js";
|
|
|
42
42
|
import { slashEnd, reactStylesToString } from "./utils.js";
|
|
43
43
|
const __filename = url.fileURLToPath(import.meta.url);
|
|
44
44
|
const __dirname = path.dirname(__filename);
|
|
45
|
+
const ministaPkgUrl = path.resolve(__dirname + "/../package.json");
|
|
46
|
+
const ministaPkgUrlRelative = path.relative(".", ministaPkgUrl);
|
|
47
|
+
const ministaPkg = JSON.parse(fs.readFileSync(ministaPkgUrlRelative, "utf8"));
|
|
45
48
|
const userPkgPath = path.resolve("package.json");
|
|
46
49
|
const userPkgFilePath = path.relative(process.cwd(), userPkgPath);
|
|
47
50
|
const userPkg = JSON.parse(fs.readFileSync(userPkgFilePath, "utf8"));
|
|
48
51
|
const esbuildExternals = [
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
...Object.keys(ministaPkg.dependencies || {}),
|
|
53
|
+
...Object.keys(ministaPkg.devDependencies || {}),
|
|
54
|
+
...Object.keys(ministaPkg.peerDependencies || {}),
|
|
55
|
+
...Object.keys(userPkg.dependencies || {}),
|
|
56
|
+
...Object.keys(userPkg.devDependencies || {}),
|
|
57
|
+
...Object.keys(userPkg.peerDependencies || {}),
|
|
58
|
+
"*.css",
|
|
59
|
+
"*.scss",
|
|
60
|
+
"*.sass"
|
|
55
61
|
];
|
|
56
62
|
const esbuildLoaders = {
|
|
57
63
|
".jpg": "file",
|
|
@@ -246,10 +252,6 @@ async function buildTempAssets(viteConfig, buildOptions) {
|
|
|
246
252
|
const customFileName = slashEnd(buildOptions.outDir) + buildOptions.bundleOutName + ".css";
|
|
247
253
|
return (item == null ? void 0 : item.source) && fs.outputFile(customFileName, item == null ? void 0 : item.source);
|
|
248
254
|
} else if (item.fileName.match(/__minista_bundle_assets\.js/)) {
|
|
249
|
-
if (buildOptions.generateJs) {
|
|
250
|
-
const customFileName = slashEnd(buildOptions.outDir) + buildOptions.bundleOutName + ".js";
|
|
251
|
-
return (item == null ? void 0 : item.code) && fs.outputFile(customFileName, item == null ? void 0 : item.code);
|
|
252
|
-
}
|
|
253
255
|
return;
|
|
254
256
|
} else {
|
|
255
257
|
const customFileName = buildOptions.outDir + item.fileName.replace(buildOptions.assetDir, "");
|
|
@@ -532,14 +534,10 @@ async function buildPartialHydrateAssets(viteConfig, buildOptions) {
|
|
|
532
534
|
if (Array.isArray(items) && items.length > 0) {
|
|
533
535
|
items.map((item) => {
|
|
534
536
|
if (item.fileName.match(/\.css/)) {
|
|
535
|
-
const customFileName = slashEnd(buildOptions.outDir) + buildOptions.bundleOutName + ".css";
|
|
536
|
-
return (item == null ? void 0 : item.source) && fs.outputFile(customFileName, item == null ? void 0 : item.source);
|
|
537
|
-
} else if (item.fileName.match(/\.js/)) {
|
|
538
|
-
if (buildOptions.generateJs) {
|
|
539
|
-
const customFileName = slashEnd(buildOptions.outDir) + buildOptions.bundleOutName + ".js";
|
|
540
|
-
return (item == null ? void 0 : item.code) && fs.outputFile(customFileName, item == null ? void 0 : item.code);
|
|
541
|
-
}
|
|
542
537
|
return;
|
|
538
|
+
} else if (item.fileName.match(/\.js/)) {
|
|
539
|
+
const customFileName = slashEnd(buildOptions.outDir) + buildOptions.bundleOutName + ".js";
|
|
540
|
+
return (item == null ? void 0 : item.code) && fs.outputFile(customFileName, item == null ? void 0 : item.code);
|
|
543
541
|
} else {
|
|
544
542
|
const customFileName = buildOptions.outDir + item.fileName.replace(buildOptions.assetDir, "");
|
|
545
543
|
const customCode = (item == null ? void 0 : item.source) ? item == null ? void 0 : item.source : (item == null ? void 0 : item.code) ? item == null ? void 0 : item.code : "";
|
package/dist/esbuild.js
CHANGED
|
@@ -96,7 +96,7 @@ function partialHydrationPlugin() {
|
|
|
96
96
|
setup(build) {
|
|
97
97
|
build.onResolve({ filter: /\?ph$/ }, (args) => {
|
|
98
98
|
return {
|
|
99
|
-
path: path.isAbsolute(args.path) ? args.path : path.join(args.resolveDir, args.path),
|
|
99
|
+
path: (path.isAbsolute(args.path) ? args.path : path.join(args.resolveDir, args.path)).replaceAll("\\", "/"),
|
|
100
100
|
namespace: "partial-hydration-loader"
|
|
101
101
|
};
|
|
102
102
|
});
|
package/dist/generate.js
CHANGED
|
@@ -65,8 +65,7 @@ async function generateTempAssets(config, viteConfig) {
|
|
|
65
65
|
input: path.resolve(__dirname + "/../dist/bundle.js"),
|
|
66
66
|
bundleOutName: config.assets.bundle.outName,
|
|
67
67
|
outDir: systemConfig.temp.assets.outDir,
|
|
68
|
-
assetDir: config.assets.outDir
|
|
69
|
-
generateJs: false
|
|
68
|
+
assetDir: config.assets.outDir
|
|
70
69
|
});
|
|
71
70
|
await buildCopyDir(systemConfig.temp.assets.outDir, slashEnd(config.out) + noSlashEnd(config.assets.outDir), "assets");
|
|
72
71
|
}
|
|
@@ -105,7 +104,6 @@ async function generatePartialHydration(config, mdxConfig, viteConfig) {
|
|
|
105
104
|
bundleOutName: config.assets.partial.outName,
|
|
106
105
|
outDir: systemConfig.temp.assets.outDir,
|
|
107
106
|
assetDir: config.assets.outDir,
|
|
108
|
-
generateJs: true,
|
|
109
107
|
usePreact: config.assets.partial.usePreact
|
|
110
108
|
});
|
|
111
109
|
}
|