nitropack-nightly 2.11.0-20250228-233255.f2f95bc7 → 2.11.0-20250301-231416.f56ead19

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.
@@ -7,7 +7,7 @@ import { createUnimport, toExports } from 'unimport';
7
7
  import { watchConfig, loadConfig } from 'c12';
8
8
  import { resolveCompatibilityDatesFromEnv, formatDate, resolveCompatibilityDates, formatCompatibilityDate } from 'compatx';
9
9
  import { klona } from 'klona/full';
10
- import { isDebug, isTest, nodeMajorVersion, provider } from 'std-env';
10
+ import { isDebug, isTest, nodeMajorVersion, provider, isCI } from 'std-env';
11
11
  import { existsSync, promises } from 'node:fs';
12
12
  import defu$1, { defu } from 'defu';
13
13
  import { withLeadingSlash, withoutTrailingSlash, withTrailingSlash, withBase, parseURL, joinURL, withoutBase } from 'ufo';
@@ -2154,8 +2154,8 @@ class NodeDevWorker {
2154
2154
  handleEvent(event) {
2155
2155
  if (!this.#address || !this.#proxy) {
2156
2156
  throw createError({
2157
- statusCode: 503,
2158
- message: "worker is not ready yet"
2157
+ status: 503,
2158
+ statusText: "Dev worker is unavailable"
2159
2159
  });
2160
2160
  }
2161
2161
  return this.#proxy.handleEvent(event, { target: this.#address });
@@ -2628,7 +2628,8 @@ class DevServer {
2628
2628
  }
2629
2629
  async getWorker() {
2630
2630
  let retry = 0;
2631
- while (this.building || ++retry < 10) {
2631
+ const maxRetries = isTest || isCI ? 100 : 10;
2632
+ while (this.building || ++retry < maxRetries) {
2632
2633
  if ((this.workers.length === 0 || this.buildError) && !this.building) {
2633
2634
  return;
2634
2635
  }
@@ -2636,7 +2637,7 @@ class DevServer {
2636
2637
  if (activeWorker) {
2637
2638
  return activeWorker;
2638
2639
  }
2639
- await new Promise((resolve2) => setTimeout(resolve2, 500));
2640
+ await new Promise((resolve2) => setTimeout(resolve2, 600));
2640
2641
  }
2641
2642
  }
2642
2643
  writeBuildInfo(_worker, addr) {
@@ -2740,7 +2741,7 @@ $1`
2740
2741
  return new Response(
2741
2742
  JSON.stringify(
2742
2743
  {
2743
- error: "The dev server is unavailable.",
2744
+ error: "Dev server is unavailable.",
2744
2745
  hint: "Please reload the page and check the console for errors if the issue persists."
2745
2746
  },
2746
2747
  null,
@@ -2748,6 +2749,7 @@ $1`
2748
2749
  ),
2749
2750
  {
2750
2751
  status: 503,
2752
+ statusText: "Dev server is unavailable",
2751
2753
  headers: {
2752
2754
  "Content-Type": "application/json",
2753
2755
  "Cache-Control": "no-store",
@@ -1,3 +1,3 @@
1
- const version = "2.11.0-20250228-233255.f2f95bc7";
1
+ const version = "2.11.0-20250301-231416.f56ead19";
2
2
 
3
3
  export { version };
@@ -1,3 +1,3 @@
1
- const version = "2.11.0-20250228-233255.f2f95bc7";
1
+ const version = "2.11.0-20250301-231416.f56ead19";
2
2
 
3
3
  export { version };
@@ -1,3 +1,3 @@
1
- const version = "2.11.0-20250228-233255.f2f95bc7";
1
+ const version = "2.11.0-20250301-231416.f56ead19";
2
2
 
3
3
  export { version };
@@ -1,5 +1,6 @@
1
1
  import { builtinModules, createRequire } from 'node:module';
2
2
  import { pathToFileURL, fileURLToPath } from 'node:url';
3
+ import { isAbsolute as isAbsolute$1 } from 'node:path';
3
4
  import alias from '@rollup/plugin-alias';
4
5
  import commonjs from '@rollup/plugin-commonjs';
5
6
  import inject from '@rollup/plugin-inject';
@@ -366,14 +367,14 @@ function printWarnings(id, result, plugin) {
366
367
 
367
368
  function externals$1(opts) {
368
369
  const trackedExternals = /* @__PURE__ */ new Set();
369
- const tryResolve = (id) => {
370
+ const tryResolve = (id, importer) => {
370
371
  if (id.startsWith("\0")) {
371
372
  return id;
372
373
  }
373
374
  const res = resolveModuleURL(id, {
374
375
  try: true,
375
376
  conditions: opts.exportConditions,
376
- from: opts.moduleDirectories,
377
+ from: importer && isAbsolute(importer) ? [pathToFileURL(importer), ...opts.moduleDirectories] : opts.moduleDirectories,
377
378
  suffixes: ["", "/index"],
378
379
  extensions: [".mjs", ".cjs", ".js", ".mts", ".cts", ".ts", ".json"]
379
380
  });
@@ -411,7 +412,7 @@ function externals$1(opts) {
411
412
  return null;
412
413
  }
413
414
  if (!isAbsolute(resolved.id) || !existsSync(resolved.id) || await isDirectory(resolved.id)) {
414
- resolved.id = tryResolve(resolved.id) || resolved.id;
415
+ resolved.id = tryResolve(resolved.id, importer) || resolved.id;
415
416
  }
416
417
  if (!await isValidNodeImport(resolved.id).catch(() => false)) {
417
418
  return null;
@@ -429,7 +430,7 @@ function externals$1(opts) {
429
430
  }
430
431
  if (pkgName !== originalId) {
431
432
  if (!isAbsolute(originalId)) {
432
- const fullPath = tryResolve(originalId);
433
+ const fullPath = tryResolve(originalId, importer);
433
434
  if (fullPath) {
434
435
  trackedExternals.add(fullPath);
435
436
  return {
@@ -438,10 +439,10 @@ function externals$1(opts) {
438
439
  };
439
440
  }
440
441
  }
441
- const packageEntry = tryResolve(pkgName);
442
+ const packageEntry = tryResolve(pkgName, importer);
442
443
  if (packageEntry !== id) {
443
444
  const guessedSubpath = await lookupNodeModuleSubpath(id).catch(() => null);
444
- const resolvedGuess = guessedSubpath && tryResolve(join(pkgName, guessedSubpath));
445
+ const resolvedGuess = guessedSubpath && tryResolve(join(pkgName, guessedSubpath), importer);
445
446
  if (resolvedGuess === id) {
446
447
  trackedExternals.add(resolvedGuess);
447
448
  return {
@@ -2007,15 +2008,15 @@ export const plugins = [
2007
2008
  if (nitro.options.noExternals) {
2008
2009
  rollupConfig.plugins.push({
2009
2010
  name: "no-externals",
2010
- async resolveId(id, from, resolveOpts) {
2011
+ async resolveId(id, importer, resolveOpts) {
2011
2012
  if (nitro.options.node && (id.startsWith("node:") || builtinModules.includes(id))) {
2012
2013
  return { id, external: true };
2013
2014
  }
2014
- const resolved = await this.resolve(id, from, resolveOpts);
2015
+ const resolved = await this.resolve(id, importer, resolveOpts);
2015
2016
  if (!resolved) {
2016
2017
  const _resolved = resolveModulePath(id, {
2017
2018
  try: true,
2018
- from: nitro.options.nodeModulesDirs,
2019
+ from: importer && isAbsolute$1(importer) ? [pathToFileURL(importer), ...nitro.options.nodeModulesDirs] : nitro.options.nodeModulesDirs,
2019
2020
  suffixes: ["", "/index"],
2020
2021
  extensions: [".mjs", ".cjs", ".js", ".mts", ".cts", ".ts", ".json"],
2021
2022
  conditions: [
@@ -2033,7 +2034,7 @@ export const plugins = [
2033
2034
  if (!resolved || resolved.external && !id.endsWith(".wasm")) {
2034
2035
  throw new Error(
2035
2036
  `Cannot resolve ${JSON.stringify(id)} from ${JSON.stringify(
2036
- from
2037
+ importer
2037
2038
  )} and externals are not allowed!`
2038
2039
  );
2039
2040
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitropack-nightly",
3
- "version": "2.11.0-20250228-233255.f2f95bc7",
3
+ "version": "2.11.0-20250301-231416.f56ead19",
4
4
  "description": "Build and Deploy Universal JavaScript Servers",
5
5
  "repository": "nitrojs/nitro",
6
6
  "license": "MIT",