rspack-plugin-cloudflare 0.5.1 → 0.5.3
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/index.js +20 -12
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -2,11 +2,11 @@ import { createRequire, isBuiltin } from "node:module";
|
|
|
2
2
|
import fs, { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
import fs$1 from "node:fs/promises";
|
|
4
4
|
import path, { relative } from "node:path";
|
|
5
|
-
import { maybeStartOrUpdateRemoteProxySession,
|
|
5
|
+
import { maybeStartOrUpdateRemoteProxySession, unstable_getMiniflareWorkerOptions, unstable_getVarsForDev, unstable_readConfig, unstable_resolveNamedTunnel } from "wrangler";
|
|
6
6
|
import { createHash, randomUUID } from "node:crypto";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
import { getCloudflarePreset } from "@cloudflare/unenv-preset";
|
|
9
|
-
import { getNodeCompat, normalizeAndValidateConfig } from "@cloudflare/workers-utils";
|
|
9
|
+
import { convertConfigToBindings, getNodeCompat, normalizeAndValidateConfig, printBindings } from "@cloudflare/workers-utils";
|
|
10
10
|
import { defineEnv } from "unenv";
|
|
11
11
|
import { convertToWranglerConfig, loadAndParseConfig } from "@cloudflare/config";
|
|
12
12
|
import { WebSocketServer } from "ws";
|
|
@@ -930,8 +930,11 @@ function parseRedirects(input, { htmlHandling = void 0, maxStaticRules = MAX_STA
|
|
|
930
930
|
};
|
|
931
931
|
const REPLACERS = [
|
|
932
932
|
[/^\uFEFF/, () => EMPTY],
|
|
933
|
-
[
|
|
934
|
-
[
|
|
933
|
+
[/((?:\\\\)*?)(\\?\s+)$/, (_, m1, m2) => m1 + (m2.indexOf("\\") === 0 ? SPACE : EMPTY)],
|
|
934
|
+
[/(\\+?)\s/g, (_, m1) => {
|
|
935
|
+
const { length } = m1;
|
|
936
|
+
return m1.slice(0, length - length % 2) + SPACE;
|
|
937
|
+
}],
|
|
935
938
|
[/[\\$.|*+(){^]/g, (match) => `\\${match}`],
|
|
936
939
|
[/(?!\\)\?/g, () => "[^/]"],
|
|
937
940
|
[/^\//, () => "^"],
|
|
@@ -956,7 +959,7 @@ function parseRedirects(input, { htmlHandling = void 0, maxStaticRules = MAX_STA
|
|
|
956
959
|
const makeRegex = (pattern, ignoreCase) => {
|
|
957
960
|
let source = regexCache[pattern];
|
|
958
961
|
if (!source) {
|
|
959
|
-
source = REPLACERS.reduce((prev,
|
|
962
|
+
source = REPLACERS.reduce((prev, [matcher, replacer]) => prev.replace(matcher, replacer.bind(pattern)), pattern);
|
|
960
963
|
regexCache[pattern] = source;
|
|
961
964
|
}
|
|
962
965
|
return ignoreCase ? new RegExp(source, "i") : new RegExp(source);
|
|
@@ -1767,6 +1770,7 @@ const types$1 = {
|
|
|
1767
1770
|
"image/prs.pti": ["pti"],
|
|
1768
1771
|
"image/vnd.adobe.photoshop": ["psd"],
|
|
1769
1772
|
"image/vnd.airzip.accelerator.azv": ["azv"],
|
|
1773
|
+
"image/vnd.blockfact.facti": ["facti"],
|
|
1770
1774
|
"image/vnd.dece.graphic": [
|
|
1771
1775
|
"uvi",
|
|
1772
1776
|
"uvvi",
|
|
@@ -2410,13 +2414,16 @@ var Mime = class {
|
|
|
2410
2414
|
for (let [type, extensions] of Object.entries(typeMap)) {
|
|
2411
2415
|
type = type.toLowerCase();
|
|
2412
2416
|
extensions = extensions.map((ext) => ext.toLowerCase());
|
|
2413
|
-
|
|
2414
|
-
|
|
2417
|
+
let allExtensions = __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type);
|
|
2418
|
+
if (!allExtensions) {
|
|
2419
|
+
allExtensions = /* @__PURE__ */ new Set();
|
|
2420
|
+
__classPrivateFieldGet(this, _Mime_typeToExtensions, "f").set(type, allExtensions);
|
|
2421
|
+
}
|
|
2415
2422
|
let first = true;
|
|
2416
2423
|
for (let extension of extensions) {
|
|
2417
2424
|
const starred = extension.startsWith("*");
|
|
2418
2425
|
extension = starred ? extension.slice(1) : extension;
|
|
2419
|
-
allExtensions
|
|
2426
|
+
allExtensions.add(extension);
|
|
2420
2427
|
if (first) __classPrivateFieldGet(this, _Mime_typeToExtension, "f").set(type, extension);
|
|
2421
2428
|
first = false;
|
|
2422
2429
|
if (starred) continue;
|
|
@@ -2442,14 +2449,15 @@ var Mime = class {
|
|
|
2442
2449
|
}
|
|
2443
2450
|
getAllExtensions(type) {
|
|
2444
2451
|
if (typeof type !== "string") return null;
|
|
2445
|
-
|
|
2452
|
+
type = type.split(";")[0].trim().toLowerCase();
|
|
2453
|
+
const extensions = __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").get(type);
|
|
2454
|
+
return extensions ? new Set(extensions) : null;
|
|
2446
2455
|
}
|
|
2447
2456
|
_freeze() {
|
|
2448
2457
|
this.define = () => {
|
|
2449
2458
|
throw new Error("define() not allowed for built-in Mime objects. See https://github.com/broofa/mime/blob/main/README.md#custom-mime-instances");
|
|
2450
2459
|
};
|
|
2451
2460
|
Object.freeze(this);
|
|
2452
|
-
for (const extensions of __classPrivateFieldGet(this, _Mime_typeToExtensions, "f").values()) Object.freeze(extensions);
|
|
2453
2461
|
return this;
|
|
2454
2462
|
}
|
|
2455
2463
|
_getTestState() {
|
|
@@ -2783,7 +2791,7 @@ var DevWorker = class {
|
|
|
2783
2791
|
const { config } = this.#resolved;
|
|
2784
2792
|
this.#remoteProxy = await maybeStartOrUpdateRemoteProxySession({
|
|
2785
2793
|
name: config.name,
|
|
2786
|
-
bindings:
|
|
2794
|
+
bindings: convertConfigToBindings(config, { usePreviewIds: true }),
|
|
2787
2795
|
account_id: config.account_id,
|
|
2788
2796
|
complianceRegion: config.compliance_region
|
|
2789
2797
|
}, this.#remoteProxy);
|
|
@@ -3196,7 +3204,7 @@ var DevSession = class DevSession {
|
|
|
3196
3204
|
#printReady() {
|
|
3197
3205
|
for (const worker of this.#workers) {
|
|
3198
3206
|
const { config, name } = worker.resolved;
|
|
3199
|
-
|
|
3207
|
+
printBindings(convertConfigToBindings(config, { usePreviewIds: true }), {
|
|
3200
3208
|
name,
|
|
3201
3209
|
local: true,
|
|
3202
3210
|
warnIfNoBindings: false,
|