@nuxt/bridge-edge 3.0.0-27488954.9fbb9be → 3.0.0-27489452.8874728

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.
@@ -204,7 +204,11 @@ async function setupNitroBridge() {
204
204
  dir: nuxt.options.dev ? join$1(nuxt.options.buildDir, "nitro") : resolve(nuxt.options.rootDir, ".output")
205
205
  },
206
206
  externals: {
207
- inline: nuxt.options.dev ? [] : [nuxt.options.buildDir]
207
+ inline: [
208
+ ...nuxt.options.dev ? [] : [nuxt.options.buildDir],
209
+ "@nuxt/bridge/dist",
210
+ "@nuxt/bridge-edge/dist"
211
+ ]
208
212
  },
209
213
  alias: {
210
214
  encoding: "unenv/runtime/mock/proxy",
@@ -28,7 +28,7 @@ import 'unimport';
28
28
  import 'scule';
29
29
  import 'unplugin-vue2-script-setup/nuxt';
30
30
 
31
- const version = "3.0.0-27488954.9fbb9be";
31
+ const version = "3.0.0-27489452.8874728";
32
32
 
33
33
  const middlewareTemplate = {
34
34
  filename: "middleware.js",
@@ -2,10 +2,7 @@ import { resolve, join } from 'pathe';
2
2
  import * as vite from 'vite';
3
3
  import { logger, isIgnored } from '@nuxt/kit';
4
4
  import { findExports, sanitizeFilePath } from 'mlly';
5
- import { createServer } from 'net';
6
- import { networkInterfaces } from 'os';
7
- import fs$1, { existsSync } from 'fs';
8
- import require$$1 from 'path';
5
+ import { getPort } from 'get-port-please';
9
6
  import { joinURL, withoutLeadingSlash } from 'ufo';
10
7
  import { d as distDir } from './module.mjs';
11
8
  import { createUnplugin } from 'unplugin';
@@ -14,6 +11,7 @@ import MagicString from 'magic-string';
14
11
  import { createVuePlugin } from 'vite-plugin-vue2';
15
12
  import PluginLegacy from '@vitejs/plugin-legacy';
16
13
  import { createHash } from 'crypto';
14
+ import { existsSync } from 'fs';
17
15
  import fse from 'fs-extra';
18
16
  import { debounce } from 'perfect-debounce';
19
17
  import { pathToFileURL } from 'url';
@@ -25,6 +23,7 @@ import defu from 'defu';
25
23
  import 'node-fetch';
26
24
  import 'nitropack';
27
25
  import 'h3';
26
+ import 'path';
28
27
  import 'untyped';
29
28
  import 'acorn';
30
29
  import 'estree-walker';
@@ -35,156 +34,6 @@ import 'unimport';
35
34
  import 'scule';
36
35
  import 'unplugin-vue2-script-setup/nuxt';
37
36
 
38
- var dist = {};
39
-
40
- Object.defineProperty(dist, '__esModule', { value: true });
41
-
42
- const fs = fs$1;
43
- const path = require$$1;
44
-
45
- const _memo = {
46
- _pid: process.pid
47
- };
48
- async function getMemo(config) {
49
- const options = getOptions(config);
50
- try {
51
- const memo = JSON.parse(await fs.promises.readFile(options.file, "utf-8")) || {};
52
- if (!memo._pid) {
53
- throw new Error("Memo lacks _pid");
54
- }
55
- if (memo._pid === _memo._pid || !isAlive(memo.pid)) {
56
- Object.assign(_memo, memo);
57
- _memo._pid = process.pid;
58
- }
59
- } catch (e) {
60
- }
61
- return _memo;
62
- }
63
- async function setMemo(memo, config) {
64
- const options = getOptions(config);
65
- Object.assign(_memo, memo);
66
- _memo._pid = process.pid;
67
- try {
68
- await fs.promises.mkdir(options.dir);
69
- } catch (e) {
70
- }
71
- try {
72
- await fs.promises.writeFile(options.file, JSON.stringify(_memo), "utf-8");
73
- } catch (e) {
74
- }
75
- }
76
- function getOptions(config) {
77
- const options = {...config};
78
- options.name = options.name || "default";
79
- options.dir = options.dir || path.resolve(process.cwd(), "node_modules/.cache/fs-memo");
80
- options.file = options.file || path.resolve(options.dir, options.name + ".json");
81
- return options;
82
- }
83
- function isAlive(pid) {
84
- try {
85
- process.kill(pid, 0);
86
- return true;
87
- } catch (e) {
88
- return e.code === "EPERM";
89
- }
90
- }
91
-
92
- var getMemo_1 = dist.getMemo = getMemo;
93
- var setMemo_1 = dist.setMemo = setMemo;
94
-
95
- async function getPort(config) {
96
- if (typeof config === "number" || typeof config === "string") {
97
- config = { port: parseInt(config + "") };
98
- }
99
- const options = {
100
- name: "default",
101
- random: false,
102
- port: parseInt(process.env.PORT || "") || 3e3,
103
- ports: [4e3, 5e3, 6e3, 7e3],
104
- host: void 0,
105
- memoName: "port",
106
- ...config
107
- };
108
- if (options.random) {
109
- return getRandomPort(options.host);
110
- }
111
- const portsToCheck = [
112
- options.port,
113
- ...options.ports
114
- ].filter(Boolean);
115
- const memoOptions = { name: options.memoName, dir: options.memoDir };
116
- const memoKey = "port_" + options.name;
117
- const memo = await getMemo_1(memoOptions);
118
- if (memo[memoKey]) {
119
- portsToCheck.push(memo[memoKey]);
120
- }
121
- const availablePort = await findPort(portsToCheck, options.host);
122
- await setMemo_1({ [memoKey]: availablePort }, memoOptions);
123
- return availablePort;
124
- }
125
- async function getRandomPort(host) {
126
- const port = await checkPort(0, host);
127
- if (port === false) {
128
- throw new Error("Unable to obtain an available random port number!");
129
- }
130
- return port;
131
- }
132
- async function checkPort(port, host = process.env.HOST) {
133
- if (!host) {
134
- host = getLocalHosts([void 0, "0.0.0.0"]);
135
- }
136
- if (!Array.isArray(host)) {
137
- return _checkPort(port, host);
138
- }
139
- for (const _host of host) {
140
- const _port = await _checkPort(port, _host);
141
- if (_port === false) {
142
- return false;
143
- }
144
- if (port === 0 && _port !== 0) {
145
- port = _port;
146
- }
147
- }
148
- return port;
149
- }
150
- function _checkPort(port, host) {
151
- return new Promise((resolve) => {
152
- const server = createServer();
153
- server.unref();
154
- server.on("error", (err) => {
155
- if (err.code === "EINVAL" || err.code === "EADDRNOTAVAIL") {
156
- resolve(port !== 0 ? port : false);
157
- } else {
158
- resolve(false);
159
- }
160
- });
161
- server.listen({ port, host }, () => {
162
- const { port: port2 } = server.address();
163
- server.close(() => {
164
- resolve(port2);
165
- });
166
- });
167
- });
168
- }
169
- function getLocalHosts(additional) {
170
- const hosts = new Set(additional);
171
- for (const _interface of Object.values(networkInterfaces())) {
172
- for (const config of _interface) {
173
- hosts.add(config.address);
174
- }
175
- }
176
- return Array.from(hosts);
177
- }
178
- async function findPort(ports, host) {
179
- for (const port of ports) {
180
- const r = await checkPort(port, host);
181
- if (r) {
182
- return r;
183
- }
184
- }
185
- return getRandomPort(host);
186
- }
187
-
188
37
  async function warmupViteServer(server, entries) {
189
38
  const warmedUrls = /* @__PURE__ */ new Set();
190
39
  const warmup = async (url) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/bridge-edge",
3
- "version": "3.0.0-27488954.9fbb9be",
3
+ "version": "3.0.0-27489452.8874728",
4
4
  "repository": "nuxt/framework",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -21,9 +21,9 @@
21
21
  "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
22
22
  "@babel/plugin-proposal-optional-chaining": "^7.16.7",
23
23
  "@babel/plugin-transform-typescript": "^7.16.8",
24
- "@nuxt/kit": "npm:@nuxt/kit-edge@3.0.0-27488954.9fbb9be",
24
+ "@nuxt/kit": "npm:@nuxt/kit-edge@3.0.0-27489452.8874728",
25
25
  "@nuxt/postcss8": "^1.1.3",
26
- "@nuxt/schema": "npm:@nuxt/schema-edge@3.0.0-27488954.9fbb9be",
26
+ "@nuxt/schema": "npm:@nuxt/schema-edge@3.0.0-27489452.8874728",
27
27
  "@vitejs/plugin-legacy": "^1.8.0",
28
28
  "@vue/composition-api": "^1.4.9",
29
29
  "@vueuse/head": "^0.7.5",
@@ -36,6 +36,7 @@
36
36
  "estree-walker": "^3.0.1",
37
37
  "externality": "^0.2.1",
38
38
  "fs-extra": "^10.0.1",
39
+ "get-port-please": "^2.4.3",
39
40
  "globby": "^13.1.1",
40
41
  "h3": "^0.7.1",
41
42
  "hash-sum": "^2.0.0",
@@ -45,7 +46,7 @@
45
46
  "murmurhash-es": "^0.1.1",
46
47
  "nitropack": "^0.1.2",
47
48
  "node-fetch": "^3.2.3",
48
- "nuxi": "npm:nuxi-edge@3.0.0-27488954.9fbb9be",
49
+ "nuxi": "npm:nuxi-edge@3.0.0-27489452.8874728",
49
50
  "ohash": "^0.1.0",
50
51
  "pathe": "^0.2.0",
51
52
  "perfect-debounce": "^0.1.3",