@webjourney/vite-plugins 1.2.15 → 1.2.16

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.
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,wBAAsB,YAAY,CAAC,OAAO,GAAE,YAAiB,iBA+C5D"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,wBAAsB,YAAY,CAAC,OAAO,GAAE,YAAiB,iBA6C5D"}
package/dist/build.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { match as matchMedia } from 'css-mediaquery';
2
2
  import { JSDOM } from 'jsdom';
3
3
  import { execSync } from 'node:child_process';
4
- import fs from 'node:fs';
4
+ import fs from 'node:fs/promises';
5
5
  import { createRequire } from 'node:module';
6
6
  import path from 'node:path';
7
7
  export async function buildWithSSR(options = {}) {
@@ -18,7 +18,7 @@ export const render = createServerRenderer(App);
18
18
  console.log('Building for production with SSR...\n');
19
19
  try {
20
20
  // Write temporary entry-server file
21
- fs.writeFileSync(generatedEntryServer, entryServerContent);
21
+ await fs.writeFile(generatedEntryServer, entryServerContent);
22
22
  // Step 1: Type check
23
23
  console.log('1. Type checking...');
24
24
  execSync('tsc -b', { stdio: 'inherit', cwd: projectRoot });
@@ -35,9 +35,7 @@ export const render = createServerRenderer(App);
35
35
  }
36
36
  finally {
37
37
  // Clean up temporary entry-server file
38
- if (fs.existsSync(generatedEntryServer)) {
39
- fs.unlinkSync(generatedEntryServer);
40
- }
38
+ await fs.unlink(generatedEntryServer).catch(() => { });
41
39
  }
42
40
  }
43
41
  function setupSSREnvironment() {
@@ -211,7 +209,7 @@ async function prerender(projectRoot) {
211
209
  const toAbsolute = (p) => path.resolve(projectRoot, p);
212
210
  // Read the built index.html
213
211
  const templatePath = toAbsolute('dist/index.html');
214
- const template = fs.readFileSync(templatePath, 'utf-8');
212
+ const template = await fs.readFile(templatePath, 'utf-8');
215
213
  // Setup SSR environment with all necessary polyfills
216
214
  const { cleanup } = setupSSREnvironment();
217
215
  // Import the server entry after setting up globals
@@ -228,7 +226,10 @@ async function prerender(projectRoot) {
228
226
  // Generate sitemap
229
227
  const hostname = process.env.WEBJOURNEY_PROJECT_ID ? `https://${process.env.WEBJOURNEY_PROJECT_ID}.web.wbj.dev` : 'http://127.0.0.1';
230
228
  const sitemap = generateSitemap(routes, hostname);
231
- fs.writeFileSync(toAbsolute('dist/sitemap.xml'), sitemap);
229
+ await Promise.all([
230
+ fs.writeFile(toAbsolute('public/sitemap.xml'), sitemap),
231
+ fs.writeFile(toAbsolute('dist/sitemap.xml'), sitemap),
232
+ ]);
232
233
  console.log(' Generated: sitemap.xml');
233
234
  for (const route of routes) {
234
235
  // Render the app HTML
@@ -248,10 +249,8 @@ async function prerender(projectRoot) {
248
249
  : toAbsolute(`dist${route}/index.html`);
249
250
  // Ensure directory exists
250
251
  const dir = path.dirname(filePath);
251
- if (!fs.existsSync(dir)) {
252
- fs.mkdirSync(dir, { recursive: true });
253
- }
254
- fs.writeFileSync(filePath, html);
252
+ await fs.mkdir(dir, { recursive: true });
253
+ await fs.writeFile(filePath, html);
255
254
  console.log(` Pre-rendered: ${route}`);
256
255
  }
257
256
  // Wait for any pending console messages to flush
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webjourney/vite-plugins",
3
- "version": "1.2.15",
3
+ "version": "1.2.16",
4
4
  "description": "Vite plugins for Webjourney WYSIWYG editing",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",