nitro-nightly 3.0.1-20251210-165820-f6618025 → 3.0.1-20251210-205305-4754f28d

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.
@@ -24,7 +24,7 @@ import { t as json } from "../_libs/@rollup/plugin-json.mjs";
24
24
  import { t as nodeResolve } from "../_libs/@rollup/plugin-node-resolve.mjs";
25
25
  import { watch } from "node:fs";
26
26
  import { defu } from "defu";
27
- import { transform } from "oxc-transform";
27
+ import { transformSync } from "oxc-transform";
28
28
  import { minifySync } from "oxc-minify";
29
29
 
30
30
  //#region src/build/plugins/oxc.ts
@@ -34,10 +34,12 @@ function oxc(options) {
34
34
  transform: {
35
35
  filter: { id: /^(?!.*\/node_modules\/).*\.m?[jt]sx?$/ },
36
36
  handler(code, id) {
37
- return transform(id, code, {
37
+ const res = transformSync(id, code, {
38
38
  sourcemap: options.sourcemap,
39
39
  ...options.transform
40
40
  });
41
+ if (res.errors?.length > 0) this.error(res.errors.join("\n"));
42
+ return res;
41
43
  }
42
44
  },
43
45
  renderChunk(code, chunk) {
@@ -713,8 +713,15 @@ function routeMeta(nitro) {
713
713
  async handler(code, id) {
714
714
  let meta = null;
715
715
  try {
716
- const jsCode = transformSync(id, code).code;
717
- const ast = this.parse(jsCode);
716
+ const transformRes = transformSync(id, code);
717
+ if (transformRes.errors?.length > 0) {
718
+ for (const error of transformRes.errors) this.warn(error);
719
+ return {
720
+ code: `export default {};`,
721
+ map: null
722
+ };
723
+ }
724
+ const ast = this.parse(transformRes.code);
718
725
  for (const node of ast.body) if (node.type === "ExpressionStatement" && node.expression.type === "CallExpression" && node.expression.callee.type === "Identifier" && node.expression.callee.name === "defineRouteMeta" && node.expression.arguments.length === 1) {
719
726
  meta = astToObject(node.expression.arguments[0]);
720
727
  break;
@@ -347,7 +347,7 @@ function createNitroEnvironment(ctx) {
347
347
  minify: ctx.nitro.options.minify,
348
348
  emptyOutDir: false,
349
349
  sourcemap: ctx.nitro.options.sourcemap,
350
- commonjsOptions: { ...ctx.nitro.options.commonJS }
350
+ commonjsOptions: ctx.nitro.options.commonJS
351
351
  },
352
352
  resolve: {
353
353
  noExternal: ctx.nitro.options.dev ? [
@@ -358,6 +358,7 @@ function createNitroEnvironment(ctx) {
358
358
  conditions: ctx.nitro.options.exportConditions,
359
359
  externalConditions: ctx.nitro.options.exportConditions?.filter((c) => !/browser|wasm/.test(c))
360
360
  },
361
+ define: { "process.env.NODE_ENV": JSON.stringify(ctx.nitro.options.dev ? "development" : "production") },
361
362
  dev: { createEnvironment: (envName, envConfig) => createFetchableDevEnvironment(envName, envConfig, getEnvRunner(ctx), resolve(runtimeDir, "internal/vite/dev-entry.mjs")) }
362
363
  };
363
364
  }
@@ -372,7 +373,6 @@ function createServiceEnvironment(ctx, name, serviceConfig) {
372
373
  emptyOutDir: true
373
374
  },
374
375
  resolve: {
375
- noExternal: ctx.nitro.options.dev ? void 0 : [/react/],
376
376
  conditions: ctx.nitro.options.exportConditions,
377
377
  externalConditions: ctx.nitro.options.exportConditions?.filter((c) => !/browser|wasm/.test(c))
378
378
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitro-nightly",
3
- "version": "3.0.1-20251210-165820-f6618025",
3
+ "version": "3.0.1-20251210-205305-4754f28d",
4
4
  "description": "Build and Deploy Universal JavaScript Servers",
5
5
  "homepage": "https://nitro.build",
6
6
  "repository": "nitrojs/nitro",