@fluenti/next 0.2.0 → 0.3.0
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/chunk-C5jLAML2.cjs +1 -0
- package/dist/chunk-DpeYiwci.js +7 -0
- package/dist/dev-runner.d.ts +2 -0
- package/dist/dev-runner.d.ts.map +1 -1
- package/dist/dev-watcher.d.ts +36 -0
- package/dist/dev-watcher.d.ts.map +1 -0
- package/dist/generate-server-module.d.ts.map +1 -1
- package/dist/index.cjs +56 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1112 -144
- package/dist/index.js.map +1 -1
- package/dist/loader.cjs +1 -1
- package/dist/loader.cjs.map +1 -1
- package/dist/loader.js +23 -23
- package/dist/loader.js.map +1 -1
- package/dist/middleware.d.ts +109 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/navigation.d.ts +34 -0
- package/dist/navigation.d.ts.map +1 -0
- package/dist/provider.cjs +2 -2
- package/dist/provider.cjs.map +1 -1
- package/dist/provider.js +28 -30
- package/dist/provider.js.map +1 -1
- package/dist/read-config.d.ts +2 -0
- package/dist/read-config.d.ts.map +1 -1
- package/dist/types.d.ts +17 -27
- package/dist/types.d.ts.map +1 -1
- package/dist/with-fluenti.d.ts.map +1 -1
- package/llms-full.txt +122 -0
- package/llms-migration.txt +262 -0
- package/llms.txt +55 -0
- package/package.json +7 -5
- package/dist/scope-transform.d.ts +0 -3
- package/dist/scope-transform.d.ts.map +0 -1
- package/dist/trans-transform.d.ts +0 -3
- package/dist/trans-transform.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,105 +1,109 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { validateLocale as
|
|
1
|
+
import { t as e } from "./chunk-DpeYiwci.js";
|
|
2
|
+
import { existsSync as t, mkdirSync as n, watch as r, writeFileSync as i } from "node:fs";
|
|
3
|
+
import { dirname as a, join as o, relative as s, resolve as c } from "node:path";
|
|
4
|
+
import { DEFAULT_FLUENTI_CONFIG as l, loadConfigSync as u } from "@fluenti/core/config";
|
|
5
|
+
import { validateLocale as d } from "@fluenti/core";
|
|
6
|
+
import { resolveLocaleCodes as f } from "@fluenti/core/internal";
|
|
7
|
+
import { exec as p } from "node:child_process";
|
|
8
|
+
import { createRequire as m } from "node:module";
|
|
6
9
|
//#region src/read-config.ts
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
function h(e, t) {
|
|
11
|
+
let n;
|
|
12
|
+
n = t?.config && typeof t.config == "object" ? {
|
|
13
|
+
...l,
|
|
14
|
+
...t.config
|
|
15
|
+
} : u(typeof t?.config == "string" ? t.config : void 0, e);
|
|
16
|
+
let r = t?.serverModuleOutDir ?? ".fluenti", i = t?.cookieName ?? "locale", a = {
|
|
17
|
+
fluentiConfig: n,
|
|
13
18
|
serverModule: t?.serverModule ?? null,
|
|
14
|
-
serverModuleOutDir:
|
|
19
|
+
serverModuleOutDir: r,
|
|
20
|
+
cookieName: i
|
|
15
21
|
};
|
|
16
|
-
return t?.resolveLocale && (
|
|
17
|
-
}
|
|
18
|
-
function v(t) {
|
|
19
|
-
let n = g(h, {
|
|
20
|
-
moduleCache: !1,
|
|
21
|
-
interopDefault: !0
|
|
22
|
-
});
|
|
23
|
-
for (let r of [
|
|
24
|
-
"fluenti.config.ts",
|
|
25
|
-
"fluenti.config.js",
|
|
26
|
-
"fluenti.config.mjs"
|
|
27
|
-
]) {
|
|
28
|
-
let i = f(t, r);
|
|
29
|
-
if (e(i)) try {
|
|
30
|
-
return b(n(i));
|
|
31
|
-
} catch {
|
|
32
|
-
return y(i, n) || null;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
function y(e, t) {
|
|
38
|
-
let a = n(e, "utf8"), o = a.match(/import\s*\{\s*defineConfig(?:\s+as\s+([A-Za-z_$][\w$]*))?\s*\}\s*from\s*['"]@fluenti\/cli['"]\s*;?/);
|
|
39
|
-
if (!o) return null;
|
|
40
|
-
let d = o[1] ?? "defineConfig", f = a.replace(o[0], ""), p = u(c(e), `.${s(e, l(e))}.next-plugin-read-config${l(e) || ".ts"}`);
|
|
41
|
-
i(p, `const ${d} = (config) => config\n${f}`, "utf8");
|
|
42
|
-
try {
|
|
43
|
-
return b(t(p));
|
|
44
|
-
} catch {
|
|
45
|
-
return null;
|
|
46
|
-
} finally {
|
|
47
|
-
r(p, { force: !0 });
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
function b(e) {
|
|
51
|
-
return typeof e == "object" && e && "default" in e ? e.default ?? {} : e;
|
|
22
|
+
return t?.resolveLocale && (a.resolveLocale = t.resolveLocale), a;
|
|
52
23
|
}
|
|
53
24
|
//#endregion
|
|
54
25
|
//#region src/generate-server-module.ts
|
|
55
|
-
function
|
|
56
|
-
if (r.serverModule) return
|
|
57
|
-
let a =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
26
|
+
function g(e, r) {
|
|
27
|
+
if (r.serverModule) return c(e, r.serverModule);
|
|
28
|
+
let a = c(e, r.serverModuleOutDir), o = c(a, "server.js"), l = c(a, "server.d.ts");
|
|
29
|
+
t(a) || n(a, { recursive: !0 });
|
|
30
|
+
let u = f(r.fluentiConfig.locales), p = r.fluentiConfig.defaultLocale ?? r.fluentiConfig.sourceLocale, m = r.fluentiConfig.compileOutDir, h = r.fluentiConfig.fallbackChain;
|
|
31
|
+
for (let e of u) d(e, "next-plugin");
|
|
32
|
+
let g = _(s(a, c(e, m))), v = u.map((e) => ` case '${e}': return import('${g}/${e}')`).join("\n"), y = h ? JSON.stringify(h) : "undefined";
|
|
33
|
+
i(c(a, "client-provider.js"), `"use client";
|
|
62
34
|
// Auto-generated by @fluenti/next — do not edit
|
|
63
35
|
import { createElement } from 'react'
|
|
64
36
|
import { I18nProvider } from '@fluenti/react'
|
|
65
|
-
${
|
|
37
|
+
${u.map((e) => `import ${e.replace(/[^a-zA-Z0-9]/g, "_")} from '${g}/${e}'`).join("\n")}
|
|
66
38
|
|
|
67
|
-
const __allMessages = { ${
|
|
39
|
+
const __allMessages = { ${u.map((e) => `'${e}': ${e.replace(/[^a-zA-Z0-9]/g, "_")}`).join(", ")} }
|
|
68
40
|
|
|
69
41
|
export function ClientI18nProvider({ locale, fallbackLocale, fallbackChain, children }) {
|
|
70
42
|
return createElement(I18nProvider, { locale, fallbackLocale, messages: __allMessages, fallbackChain }, children)
|
|
71
43
|
}
|
|
72
44
|
`, "utf-8");
|
|
73
|
-
let
|
|
45
|
+
let b = r.resolveLocale ? `import __resolveLocale from '${_(s(a, c(e, r.resolveLocale)))}'` : null, x = r.resolveLocale ? "resolveLocale: __resolveLocale," : `resolveLocale: async () => {
|
|
74
46
|
try {
|
|
75
|
-
const { cookies } = await import('next/headers')
|
|
76
|
-
|
|
47
|
+
const { cookies, headers } = await import('next/headers')
|
|
48
|
+
const [cookieStore, headerStore] = await Promise.all([cookies(), headers()])
|
|
49
|
+
|
|
50
|
+
// 1. Referer URL path segment (available in Server Action context)
|
|
51
|
+
const referer = headerStore.get('referer')
|
|
52
|
+
if (referer) {
|
|
53
|
+
try {
|
|
54
|
+
const seg = new URL(referer).pathname.split('/')[1]
|
|
55
|
+
if (seg && __locales.includes(seg)) return seg
|
|
56
|
+
} catch {}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// 2. Cookie (configurable name)
|
|
60
|
+
const fromCookie = cookieStore.get('${r.cookieName}')?.value
|
|
61
|
+
if (fromCookie && __locales.includes(fromCookie)) return fromCookie
|
|
62
|
+
|
|
63
|
+
// 3. Accept-Language header
|
|
64
|
+
const acceptLang = headerStore.get('accept-language')
|
|
65
|
+
if (acceptLang) {
|
|
66
|
+
for (const part of acceptLang.split(',')) {
|
|
67
|
+
const lang = part.split(';')[0].trim()
|
|
68
|
+
if (__locales.includes(lang)) return lang
|
|
69
|
+
const prefix = lang.split('-')[0]
|
|
70
|
+
const match = __locales.find(l => l === prefix || l.startsWith(prefix + '-'))
|
|
71
|
+
if (match) return match
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return '${p}'
|
|
77
76
|
} catch {
|
|
78
|
-
return '${
|
|
77
|
+
return '${p}'
|
|
79
78
|
}
|
|
80
|
-
}
|
|
79
|
+
},`, S = JSON.stringify(u);
|
|
81
80
|
return i(o, `// Auto-generated by @fluenti/next — do not edit
|
|
82
81
|
import { createServerI18n } from '@fluenti/react/server'
|
|
83
82
|
import { createElement } from 'react'
|
|
84
|
-
${
|
|
83
|
+
${b ? `${b}\n` : ""}
|
|
84
|
+
const __locales = ${S}
|
|
85
|
+
|
|
85
86
|
const serverI18n = createServerI18n({
|
|
86
87
|
loadMessages: async (locale) => {
|
|
87
88
|
switch (locale) {
|
|
88
|
-
${
|
|
89
|
-
default: return import('${
|
|
89
|
+
${v}
|
|
90
|
+
default: return import('${g}/${p}')
|
|
90
91
|
}
|
|
91
92
|
},
|
|
92
|
-
fallbackLocale: '${
|
|
93
|
-
fallbackChain: ${
|
|
94
|
-
${
|
|
93
|
+
fallbackLocale: '${p}',
|
|
94
|
+
fallbackChain: ${y},
|
|
95
|
+
${x}
|
|
95
96
|
})
|
|
96
97
|
|
|
97
98
|
export const setLocale = serverI18n.setLocale
|
|
98
99
|
export const getI18n = serverI18n.getI18n
|
|
99
100
|
export const t = (..._args) => {
|
|
100
101
|
throw new Error(
|
|
101
|
-
"[fluenti] \`t\` imported from '@fluenti/next' is a compile-time API
|
|
102
|
-
'
|
|
102
|
+
"[fluenti] \`t\` imported from '@fluenti/next' is a compile-time API replaced at build time.\\n" +
|
|
103
|
+
' Ensure:\\n' +
|
|
104
|
+
' 1. \`withFluenti()\` is configured in next.config.ts\\n' +
|
|
105
|
+
' 2. The file is inside src/ (not node_modules)\\n' +
|
|
106
|
+
" 3. For client components, import from '@fluenti/react'",
|
|
103
107
|
)
|
|
104
108
|
}
|
|
105
109
|
export const Trans = serverI18n.Trans
|
|
@@ -114,7 +118,7 @@ export const NumberFormat = serverI18n.NumberFormat
|
|
|
114
118
|
* Sets up both server-side (React.cache) and client-side (I18nProvider) i18n.
|
|
115
119
|
*/
|
|
116
120
|
export async function I18nProvider({ locale, children }) {
|
|
117
|
-
const activeLocale = locale
|
|
121
|
+
const activeLocale = (locale && locale.trim()) ? locale : '${p}'
|
|
118
122
|
|
|
119
123
|
// 1. Initialize server-side i18n (React.cache scoped)
|
|
120
124
|
serverI18n.setLocale(activeLocale)
|
|
@@ -126,31 +130,31 @@ export async function I18nProvider({ locale, children }) {
|
|
|
126
130
|
|
|
127
131
|
return createElement(ClientI18nProvider, {
|
|
128
132
|
locale: activeLocale,
|
|
129
|
-
fallbackLocale: '${
|
|
130
|
-
fallbackChain: ${
|
|
133
|
+
fallbackLocale: '${p}',
|
|
134
|
+
fallbackChain: ${y},
|
|
131
135
|
}, children)
|
|
132
136
|
}
|
|
133
|
-
`, "utf-8"), i(
|
|
137
|
+
`, "utf-8"), i(l, "// Auto-generated by @fluenti/next — do not edit\nimport type { ReactNode, ReactElement } from 'react'\nimport type { CompileTimeT, FluentiCoreInstanceFull } from '@fluenti/core'\n\nexport declare function setLocale(locale: string): void\nexport declare function getI18n(): Promise<FluentiCoreInstanceFull & { locale: string }>\nexport declare const t: CompileTimeT\n\nexport declare function Trans(props: {\n children: ReactNode\n id?: string\n context?: string\n comment?: string\n render?: (translation: ReactNode) => ReactNode\n}): Promise<ReactElement>\n\nexport declare function Plural(props: {\n value: number\n id?: string\n context?: string\n comment?: string\n zero?: ReactNode\n one?: ReactNode\n two?: ReactNode\n few?: ReactNode\n many?: ReactNode\n other: ReactNode\n offset?: number\n}): Promise<ReactElement>\n\nexport declare function Select(props: {\n value: string\n id?: string\n context?: string\n comment?: string\n other: ReactNode\n options?: Record<string, ReactNode>\n [key: string]: ReactNode | Record<string, ReactNode> | string | undefined\n}): Promise<ReactElement>\n\nexport declare function DateTime(props: {\n value: Date | number\n style?: string\n}): Promise<ReactElement>\n\nexport declare function NumberFormat(props: {\n value: number\n style?: string\n}): Promise<ReactElement>\n\nexport declare function I18nProvider(props: {\n locale?: string\n children: ReactNode\n}): Promise<ReactElement>\n", "utf-8"), o;
|
|
134
138
|
}
|
|
135
|
-
function
|
|
139
|
+
function _(e) {
|
|
136
140
|
return e.split("\\").join("/");
|
|
137
141
|
}
|
|
138
142
|
//#endregion
|
|
139
143
|
//#region src/dev-runner.ts
|
|
140
|
-
function
|
|
141
|
-
let n =
|
|
144
|
+
function v(e) {
|
|
145
|
+
let n = e;
|
|
142
146
|
for (;;) {
|
|
143
|
-
let
|
|
144
|
-
if (e
|
|
145
|
-
let r =
|
|
147
|
+
let e = c(n, "node_modules/.bin/fluenti");
|
|
148
|
+
if (t(e)) return e;
|
|
149
|
+
let r = a(n);
|
|
146
150
|
if (r === n) break;
|
|
147
151
|
n = r;
|
|
148
152
|
}
|
|
149
153
|
return null;
|
|
150
154
|
}
|
|
151
|
-
async function
|
|
155
|
+
async function y(e) {
|
|
152
156
|
if (e.compileOnly) try {
|
|
153
|
-
let { runCompile: t } =
|
|
157
|
+
let { runCompile: t } = m(o(e.cwd, "package.json"))("@fluenti/cli");
|
|
154
158
|
await t(e.cwd), console.log("[fluenti] Compiling... done"), e.onSuccess?.();
|
|
155
159
|
return;
|
|
156
160
|
} catch (t) {
|
|
@@ -159,14 +163,19 @@ async function w(e) {
|
|
|
159
163
|
console.warn("[fluenti] Compile failed:", n.message), e.onError?.(n);
|
|
160
164
|
return;
|
|
161
165
|
}
|
|
162
|
-
|
|
166
|
+
try {
|
|
167
|
+
let { runExtract: t, runCompile: n } = m(o(e.cwd, "package.json"))("@fluenti/cli");
|
|
168
|
+
await t(e.cwd), await n(e.cwd, { parallel: e.parallelCompile }), console.log("[fluenti] Extracting and compiling... done"), e.onSuccess?.();
|
|
169
|
+
return;
|
|
170
|
+
} catch {}
|
|
171
|
+
let t = v(e.cwd);
|
|
163
172
|
if (!t) {
|
|
164
173
|
let t = "[fluenti] CLI not found — skipping auto-compile. Install @fluenti/cli as a devDependency.";
|
|
165
174
|
return e.throwOnError ? Promise.reject(Error(t)) : (console.warn(t), Promise.resolve());
|
|
166
175
|
}
|
|
167
|
-
let n = `${t} extract && ${t} compile`;
|
|
176
|
+
let n = `${t} extract && ${t} compile${e.parallelCompile ? " --parallel" : ""}`;
|
|
168
177
|
return new Promise((t, r) => {
|
|
169
|
-
|
|
178
|
+
p(n, { cwd: e.cwd }, (n, i, a) => {
|
|
170
179
|
if (n) {
|
|
171
180
|
let t = Error(a || n.message);
|
|
172
181
|
if (e.throwOnError) {
|
|
@@ -179,12 +188,12 @@ async function w(e) {
|
|
|
179
188
|
});
|
|
180
189
|
});
|
|
181
190
|
}
|
|
182
|
-
function
|
|
191
|
+
function b(e, t = 300) {
|
|
183
192
|
let n = null, r = !1, i = !1;
|
|
184
193
|
async function a() {
|
|
185
194
|
r = !0;
|
|
186
195
|
try {
|
|
187
|
-
await
|
|
196
|
+
await y(e);
|
|
188
197
|
} finally {
|
|
189
198
|
r = !1, i && (i = !1, o());
|
|
190
199
|
}
|
|
@@ -197,83 +206,1042 @@ function T(e, t = 300) {
|
|
|
197
206
|
return o;
|
|
198
207
|
}
|
|
199
208
|
//#endregion
|
|
209
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.js
|
|
210
|
+
var x = /* @__PURE__ */ e(((e, t) => {
|
|
211
|
+
var n = "\\\\/", r = `[^${n}]`, i = "\\.", a = "\\+", o = "\\?", s = "\\/", c = "(?=.)", l = "[^/]", u = `(?:${s}|$)`, d = `(?:^|${s})`, f = `${i}{1,2}${u}`, p = {
|
|
212
|
+
DOT_LITERAL: i,
|
|
213
|
+
PLUS_LITERAL: a,
|
|
214
|
+
QMARK_LITERAL: o,
|
|
215
|
+
SLASH_LITERAL: s,
|
|
216
|
+
ONE_CHAR: c,
|
|
217
|
+
QMARK: l,
|
|
218
|
+
END_ANCHOR: u,
|
|
219
|
+
DOTS_SLASH: f,
|
|
220
|
+
NO_DOT: `(?!${i})`,
|
|
221
|
+
NO_DOTS: `(?!${d}${f})`,
|
|
222
|
+
NO_DOT_SLASH: `(?!${i}{0,1}${u})`,
|
|
223
|
+
NO_DOTS_SLASH: `(?!${f})`,
|
|
224
|
+
QMARK_NO_DOT: `[^.${s}]`,
|
|
225
|
+
STAR: `${l}*?`,
|
|
226
|
+
START_ANCHOR: d,
|
|
227
|
+
SEP: "/"
|
|
228
|
+
}, m = {
|
|
229
|
+
...p,
|
|
230
|
+
SLASH_LITERAL: `[${n}]`,
|
|
231
|
+
QMARK: r,
|
|
232
|
+
STAR: `${r}*?`,
|
|
233
|
+
DOTS_SLASH: `${i}{1,2}(?:[${n}]|$)`,
|
|
234
|
+
NO_DOT: `(?!${i})`,
|
|
235
|
+
NO_DOTS: `(?!(?:^|[${n}])${i}{1,2}(?:[${n}]|$))`,
|
|
236
|
+
NO_DOT_SLASH: `(?!${i}{0,1}(?:[${n}]|$))`,
|
|
237
|
+
NO_DOTS_SLASH: `(?!${i}{1,2}(?:[${n}]|$))`,
|
|
238
|
+
QMARK_NO_DOT: `[^.${n}]`,
|
|
239
|
+
START_ANCHOR: `(?:^|[${n}])`,
|
|
240
|
+
END_ANCHOR: `(?:[${n}]|$)`,
|
|
241
|
+
SEP: "\\"
|
|
242
|
+
};
|
|
243
|
+
t.exports = {
|
|
244
|
+
MAX_LENGTH: 1024 * 64,
|
|
245
|
+
POSIX_REGEX_SOURCE: {
|
|
246
|
+
alnum: "a-zA-Z0-9",
|
|
247
|
+
alpha: "a-zA-Z",
|
|
248
|
+
ascii: "\\x00-\\x7F",
|
|
249
|
+
blank: " \\t",
|
|
250
|
+
cntrl: "\\x00-\\x1F\\x7F",
|
|
251
|
+
digit: "0-9",
|
|
252
|
+
graph: "\\x21-\\x7E",
|
|
253
|
+
lower: "a-z",
|
|
254
|
+
print: "\\x20-\\x7E ",
|
|
255
|
+
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
256
|
+
space: " \\t\\r\\n\\v\\f",
|
|
257
|
+
upper: "A-Z",
|
|
258
|
+
word: "A-Za-z0-9_",
|
|
259
|
+
xdigit: "A-Fa-f0-9"
|
|
260
|
+
},
|
|
261
|
+
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
262
|
+
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
263
|
+
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
264
|
+
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
265
|
+
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
266
|
+
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
267
|
+
REPLACEMENTS: {
|
|
268
|
+
__proto__: null,
|
|
269
|
+
"***": "*",
|
|
270
|
+
"**/**": "**",
|
|
271
|
+
"**/**/**": "**"
|
|
272
|
+
},
|
|
273
|
+
CHAR_0: 48,
|
|
274
|
+
CHAR_9: 57,
|
|
275
|
+
CHAR_UPPERCASE_A: 65,
|
|
276
|
+
CHAR_LOWERCASE_A: 97,
|
|
277
|
+
CHAR_UPPERCASE_Z: 90,
|
|
278
|
+
CHAR_LOWERCASE_Z: 122,
|
|
279
|
+
CHAR_LEFT_PARENTHESES: 40,
|
|
280
|
+
CHAR_RIGHT_PARENTHESES: 41,
|
|
281
|
+
CHAR_ASTERISK: 42,
|
|
282
|
+
CHAR_AMPERSAND: 38,
|
|
283
|
+
CHAR_AT: 64,
|
|
284
|
+
CHAR_BACKWARD_SLASH: 92,
|
|
285
|
+
CHAR_CARRIAGE_RETURN: 13,
|
|
286
|
+
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
287
|
+
CHAR_COLON: 58,
|
|
288
|
+
CHAR_COMMA: 44,
|
|
289
|
+
CHAR_DOT: 46,
|
|
290
|
+
CHAR_DOUBLE_QUOTE: 34,
|
|
291
|
+
CHAR_EQUAL: 61,
|
|
292
|
+
CHAR_EXCLAMATION_MARK: 33,
|
|
293
|
+
CHAR_FORM_FEED: 12,
|
|
294
|
+
CHAR_FORWARD_SLASH: 47,
|
|
295
|
+
CHAR_GRAVE_ACCENT: 96,
|
|
296
|
+
CHAR_HASH: 35,
|
|
297
|
+
CHAR_HYPHEN_MINUS: 45,
|
|
298
|
+
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
299
|
+
CHAR_LEFT_CURLY_BRACE: 123,
|
|
300
|
+
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
301
|
+
CHAR_LINE_FEED: 10,
|
|
302
|
+
CHAR_NO_BREAK_SPACE: 160,
|
|
303
|
+
CHAR_PERCENT: 37,
|
|
304
|
+
CHAR_PLUS: 43,
|
|
305
|
+
CHAR_QUESTION_MARK: 63,
|
|
306
|
+
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
307
|
+
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
308
|
+
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
309
|
+
CHAR_SEMICOLON: 59,
|
|
310
|
+
CHAR_SINGLE_QUOTE: 39,
|
|
311
|
+
CHAR_SPACE: 32,
|
|
312
|
+
CHAR_TAB: 9,
|
|
313
|
+
CHAR_UNDERSCORE: 95,
|
|
314
|
+
CHAR_VERTICAL_LINE: 124,
|
|
315
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
316
|
+
extglobChars(e) {
|
|
317
|
+
return {
|
|
318
|
+
"!": {
|
|
319
|
+
type: "negate",
|
|
320
|
+
open: "(?:(?!(?:",
|
|
321
|
+
close: `))${e.STAR})`
|
|
322
|
+
},
|
|
323
|
+
"?": {
|
|
324
|
+
type: "qmark",
|
|
325
|
+
open: "(?:",
|
|
326
|
+
close: ")?"
|
|
327
|
+
},
|
|
328
|
+
"+": {
|
|
329
|
+
type: "plus",
|
|
330
|
+
open: "(?:",
|
|
331
|
+
close: ")+"
|
|
332
|
+
},
|
|
333
|
+
"*": {
|
|
334
|
+
type: "star",
|
|
335
|
+
open: "(?:",
|
|
336
|
+
close: ")*"
|
|
337
|
+
},
|
|
338
|
+
"@": {
|
|
339
|
+
type: "at",
|
|
340
|
+
open: "(?:",
|
|
341
|
+
close: ")"
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
},
|
|
345
|
+
globChars(e) {
|
|
346
|
+
return e === !0 ? m : p;
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
})), S = /* @__PURE__ */ e(((e) => {
|
|
350
|
+
var { REGEX_BACKSLASH: t, REGEX_REMOVE_BACKSLASH: n, REGEX_SPECIAL_CHARS: r, REGEX_SPECIAL_CHARS_GLOBAL: i } = x();
|
|
351
|
+
e.isObject = (e) => typeof e == "object" && !!e && !Array.isArray(e), e.hasRegexChars = (e) => r.test(e), e.isRegexChar = (t) => t.length === 1 && e.hasRegexChars(t), e.escapeRegex = (e) => e.replace(i, "\\$1"), e.toPosixSlashes = (e) => e.replace(t, "/"), e.isWindows = () => {
|
|
352
|
+
if (typeof navigator < "u" && navigator.platform) {
|
|
353
|
+
let e = navigator.platform.toLowerCase();
|
|
354
|
+
return e === "win32" || e === "windows";
|
|
355
|
+
}
|
|
356
|
+
return typeof process < "u" && process.platform ? process.platform === "win32" : !1;
|
|
357
|
+
}, e.removeBackslashes = (e) => e.replace(n, (e) => e === "\\" ? "" : e), e.escapeLast = (t, n, r) => {
|
|
358
|
+
let i = t.lastIndexOf(n, r);
|
|
359
|
+
return i === -1 ? t : t[i - 1] === "\\" ? e.escapeLast(t, n, i - 1) : `${t.slice(0, i)}\\${t.slice(i)}`;
|
|
360
|
+
}, e.removePrefix = (e, t = {}) => {
|
|
361
|
+
let n = e;
|
|
362
|
+
return n.startsWith("./") && (n = n.slice(2), t.prefix = "./"), n;
|
|
363
|
+
}, e.wrapOutput = (e, t = {}, n = {}) => {
|
|
364
|
+
let r = `${n.contains ? "" : "^"}(?:${e})${n.contains ? "" : "$"}`;
|
|
365
|
+
return t.negated === !0 && (r = `(?:^(?!${r}).*$)`), r;
|
|
366
|
+
}, e.basename = (e, { windows: t } = {}) => {
|
|
367
|
+
let n = e.split(t ? /[\\/]/ : "/"), r = n[n.length - 1];
|
|
368
|
+
return r === "" ? n[n.length - 2] : r;
|
|
369
|
+
};
|
|
370
|
+
})), C = /* @__PURE__ */ e(((e, t) => {
|
|
371
|
+
var n = S(), { CHAR_ASTERISK: r, CHAR_AT: i, CHAR_BACKWARD_SLASH: a, CHAR_COMMA: o, CHAR_DOT: s, CHAR_EXCLAMATION_MARK: c, CHAR_FORWARD_SLASH: l, CHAR_LEFT_CURLY_BRACE: u, CHAR_LEFT_PARENTHESES: d, CHAR_LEFT_SQUARE_BRACKET: f, CHAR_PLUS: p, CHAR_QUESTION_MARK: m, CHAR_RIGHT_CURLY_BRACE: h, CHAR_RIGHT_PARENTHESES: g, CHAR_RIGHT_SQUARE_BRACKET: _ } = x(), v = (e) => e === l || e === a, y = (e) => {
|
|
372
|
+
e.isPrefix !== !0 && (e.depth = e.isGlobstar ? Infinity : 1);
|
|
373
|
+
};
|
|
374
|
+
t.exports = (e, t) => {
|
|
375
|
+
let b = t || {}, x = e.length - 1, S = b.parts === !0 || b.scanToEnd === !0, C = [], w = [], T = [], E = e, D = -1, O = 0, k = 0, A = !1, j = !1, M = !1, N = !1, P = !1, F = !1, I = !1, L = !1, R = !1, z = !1, B = 0, V, H, U = {
|
|
376
|
+
value: "",
|
|
377
|
+
depth: 0,
|
|
378
|
+
isGlob: !1
|
|
379
|
+
}, W = () => D >= x, G = () => E.charCodeAt(D + 1), K = () => (V = H, E.charCodeAt(++D));
|
|
380
|
+
for (; D < x;) {
|
|
381
|
+
H = K();
|
|
382
|
+
let e;
|
|
383
|
+
if (H === a) {
|
|
384
|
+
I = U.backslashes = !0, H = K(), H === u && (F = !0);
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
if (F === !0 || H === u) {
|
|
388
|
+
for (B++; W() !== !0 && (H = K());) {
|
|
389
|
+
if (H === a) {
|
|
390
|
+
I = U.backslashes = !0, K();
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
if (H === u) {
|
|
394
|
+
B++;
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
if (F !== !0 && H === s && (H = K()) === s) {
|
|
398
|
+
if (A = U.isBrace = !0, M = U.isGlob = !0, z = !0, S === !0) continue;
|
|
399
|
+
break;
|
|
400
|
+
}
|
|
401
|
+
if (F !== !0 && H === o) {
|
|
402
|
+
if (A = U.isBrace = !0, M = U.isGlob = !0, z = !0, S === !0) continue;
|
|
403
|
+
break;
|
|
404
|
+
}
|
|
405
|
+
if (H === h && (B--, B === 0)) {
|
|
406
|
+
F = !1, A = U.isBrace = !0, z = !0;
|
|
407
|
+
break;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
if (S === !0) continue;
|
|
411
|
+
break;
|
|
412
|
+
}
|
|
413
|
+
if (H === l) {
|
|
414
|
+
if (C.push(D), w.push(U), U = {
|
|
415
|
+
value: "",
|
|
416
|
+
depth: 0,
|
|
417
|
+
isGlob: !1
|
|
418
|
+
}, z === !0) continue;
|
|
419
|
+
if (V === s && D === O + 1) {
|
|
420
|
+
O += 2;
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
k = D + 1;
|
|
424
|
+
continue;
|
|
425
|
+
}
|
|
426
|
+
if (b.noext !== !0 && (H === p || H === i || H === r || H === m || H === c) && G() === d) {
|
|
427
|
+
if (M = U.isGlob = !0, N = U.isExtglob = !0, z = !0, H === c && D === O && (R = !0), S === !0) {
|
|
428
|
+
for (; W() !== !0 && (H = K());) {
|
|
429
|
+
if (H === a) {
|
|
430
|
+
I = U.backslashes = !0, H = K();
|
|
431
|
+
continue;
|
|
432
|
+
}
|
|
433
|
+
if (H === g) {
|
|
434
|
+
M = U.isGlob = !0, z = !0;
|
|
435
|
+
break;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
continue;
|
|
439
|
+
}
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
if (H === r) {
|
|
443
|
+
if (V === r && (P = U.isGlobstar = !0), M = U.isGlob = !0, z = !0, S === !0) continue;
|
|
444
|
+
break;
|
|
445
|
+
}
|
|
446
|
+
if (H === m) {
|
|
447
|
+
if (M = U.isGlob = !0, z = !0, S === !0) continue;
|
|
448
|
+
break;
|
|
449
|
+
}
|
|
450
|
+
if (H === f) {
|
|
451
|
+
for (; W() !== !0 && (e = K());) {
|
|
452
|
+
if (e === a) {
|
|
453
|
+
I = U.backslashes = !0, K();
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
456
|
+
if (e === _) {
|
|
457
|
+
j = U.isBracket = !0, M = U.isGlob = !0, z = !0;
|
|
458
|
+
break;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
if (S === !0) continue;
|
|
462
|
+
break;
|
|
463
|
+
}
|
|
464
|
+
if (b.nonegate !== !0 && H === c && D === O) {
|
|
465
|
+
L = U.negated = !0, O++;
|
|
466
|
+
continue;
|
|
467
|
+
}
|
|
468
|
+
if (b.noparen !== !0 && H === d) {
|
|
469
|
+
if (M = U.isGlob = !0, S === !0) {
|
|
470
|
+
for (; W() !== !0 && (H = K());) {
|
|
471
|
+
if (H === d) {
|
|
472
|
+
I = U.backslashes = !0, H = K();
|
|
473
|
+
continue;
|
|
474
|
+
}
|
|
475
|
+
if (H === g) {
|
|
476
|
+
z = !0;
|
|
477
|
+
break;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
continue;
|
|
481
|
+
}
|
|
482
|
+
break;
|
|
483
|
+
}
|
|
484
|
+
if (M === !0) {
|
|
485
|
+
if (z = !0, S === !0) continue;
|
|
486
|
+
break;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
b.noext === !0 && (N = !1, M = !1);
|
|
490
|
+
let q = E, J = "", Y = "";
|
|
491
|
+
O > 0 && (J = E.slice(0, O), E = E.slice(O), k -= O), q && M === !0 && k > 0 ? (q = E.slice(0, k), Y = E.slice(k)) : M === !0 ? (q = "", Y = E) : q = E, q && q !== "" && q !== "/" && q !== E && v(q.charCodeAt(q.length - 1)) && (q = q.slice(0, -1)), b.unescape === !0 && (Y &&= n.removeBackslashes(Y), q && I === !0 && (q = n.removeBackslashes(q)));
|
|
492
|
+
let X = {
|
|
493
|
+
prefix: J,
|
|
494
|
+
input: e,
|
|
495
|
+
start: O,
|
|
496
|
+
base: q,
|
|
497
|
+
glob: Y,
|
|
498
|
+
isBrace: A,
|
|
499
|
+
isBracket: j,
|
|
500
|
+
isGlob: M,
|
|
501
|
+
isExtglob: N,
|
|
502
|
+
isGlobstar: P,
|
|
503
|
+
negated: L,
|
|
504
|
+
negatedExtglob: R
|
|
505
|
+
};
|
|
506
|
+
if (b.tokens === !0 && (X.maxDepth = 0, v(H) || w.push(U), X.tokens = w), b.parts === !0 || b.tokens === !0) {
|
|
507
|
+
let t;
|
|
508
|
+
for (let n = 0; n < C.length; n++) {
|
|
509
|
+
let r = t ? t + 1 : O, i = C[n], a = e.slice(r, i);
|
|
510
|
+
b.tokens && (n === 0 && O !== 0 ? (w[n].isPrefix = !0, w[n].value = J) : w[n].value = a, y(w[n]), X.maxDepth += w[n].depth), (n !== 0 || a !== "") && T.push(a), t = i;
|
|
511
|
+
}
|
|
512
|
+
if (t && t + 1 < e.length) {
|
|
513
|
+
let n = e.slice(t + 1);
|
|
514
|
+
T.push(n), b.tokens && (w[w.length - 1].value = n, y(w[w.length - 1]), X.maxDepth += w[w.length - 1].depth);
|
|
515
|
+
}
|
|
516
|
+
X.slashes = C, X.parts = T;
|
|
517
|
+
}
|
|
518
|
+
return X;
|
|
519
|
+
};
|
|
520
|
+
})), w = /* @__PURE__ */ e(((e, t) => {
|
|
521
|
+
var n = x(), r = S(), { MAX_LENGTH: i, POSIX_REGEX_SOURCE: a, REGEX_NON_SPECIAL_CHARS: o, REGEX_SPECIAL_CHARS_BACKREF: s, REPLACEMENTS: c } = n, l = (e, t) => {
|
|
522
|
+
if (typeof t.expandRange == "function") return t.expandRange(...e, t);
|
|
523
|
+
e.sort();
|
|
524
|
+
let n = `[${e.join("-")}]`;
|
|
525
|
+
try {
|
|
526
|
+
new RegExp(n);
|
|
527
|
+
} catch {
|
|
528
|
+
return e.map((e) => r.escapeRegex(e)).join("..");
|
|
529
|
+
}
|
|
530
|
+
return n;
|
|
531
|
+
}, u = (e, t) => `Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`, d = (e, t) => {
|
|
532
|
+
if (typeof e != "string") throw TypeError("Expected a string");
|
|
533
|
+
e = c[e] || e;
|
|
534
|
+
let f = { ...t }, p = typeof f.maxLength == "number" ? Math.min(i, f.maxLength) : i, m = e.length;
|
|
535
|
+
if (m > p) throw SyntaxError(`Input length: ${m}, exceeds maximum allowed length: ${p}`);
|
|
536
|
+
let h = {
|
|
537
|
+
type: "bos",
|
|
538
|
+
value: "",
|
|
539
|
+
output: f.prepend || ""
|
|
540
|
+
}, g = [h], _ = f.capture ? "" : "?:", v = n.globChars(f.windows), y = n.extglobChars(v), { DOT_LITERAL: b, PLUS_LITERAL: x, SLASH_LITERAL: S, ONE_CHAR: C, DOTS_SLASH: w, NO_DOT: T, NO_DOT_SLASH: E, NO_DOTS_SLASH: D, QMARK: O, QMARK_NO_DOT: k, STAR: A, START_ANCHOR: j } = v, M = (e) => `(${_}(?:(?!${j}${e.dot ? w : b}).)*?)`, N = f.dot ? "" : T, P = f.dot ? O : k, F = f.bash === !0 ? M(f) : A;
|
|
541
|
+
f.capture && (F = `(${F})`), typeof f.noext == "boolean" && (f.noextglob = f.noext);
|
|
542
|
+
let I = {
|
|
543
|
+
input: e,
|
|
544
|
+
index: -1,
|
|
545
|
+
start: 0,
|
|
546
|
+
dot: f.dot === !0,
|
|
547
|
+
consumed: "",
|
|
548
|
+
output: "",
|
|
549
|
+
prefix: "",
|
|
550
|
+
backtrack: !1,
|
|
551
|
+
negated: !1,
|
|
552
|
+
brackets: 0,
|
|
553
|
+
braces: 0,
|
|
554
|
+
parens: 0,
|
|
555
|
+
quotes: 0,
|
|
556
|
+
globstar: !1,
|
|
557
|
+
tokens: g
|
|
558
|
+
};
|
|
559
|
+
e = r.removePrefix(e, I), m = e.length;
|
|
560
|
+
let L = [], R = [], z = [], B = h, V, H = () => I.index === m - 1, U = I.peek = (t = 1) => e[I.index + t], W = I.advance = () => e[++I.index] || "", G = () => e.slice(I.index + 1), K = (e = "", t = 0) => {
|
|
561
|
+
I.consumed += e, I.index += t;
|
|
562
|
+
}, q = (e) => {
|
|
563
|
+
I.output += e.output == null ? e.value : e.output, K(e.value);
|
|
564
|
+
}, J = () => {
|
|
565
|
+
let e = 1;
|
|
566
|
+
for (; U() === "!" && (U(2) !== "(" || U(3) === "?");) W(), I.start++, e++;
|
|
567
|
+
return e % 2 == 0 ? !1 : (I.negated = !0, I.start++, !0);
|
|
568
|
+
}, Y = (e) => {
|
|
569
|
+
I[e]++, z.push(e);
|
|
570
|
+
}, X = (e) => {
|
|
571
|
+
I[e]--, z.pop();
|
|
572
|
+
}, Z = (e) => {
|
|
573
|
+
if (B.type === "globstar") {
|
|
574
|
+
let t = I.braces > 0 && (e.type === "comma" || e.type === "brace"), n = e.extglob === !0 || L.length && (e.type === "pipe" || e.type === "paren");
|
|
575
|
+
e.type !== "slash" && e.type !== "paren" && !t && !n && (I.output = I.output.slice(0, -B.output.length), B.type = "star", B.value = "*", B.output = F, I.output += B.output);
|
|
576
|
+
}
|
|
577
|
+
if (L.length && e.type !== "paren" && (L[L.length - 1].inner += e.value), (e.value || e.output) && q(e), B && B.type === "text" && e.type === "text") {
|
|
578
|
+
B.output = (B.output || B.value) + e.value, B.value += e.value;
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
e.prev = B, g.push(e), B = e;
|
|
582
|
+
}, Q = (e, t) => {
|
|
583
|
+
let n = {
|
|
584
|
+
...y[t],
|
|
585
|
+
conditions: 1,
|
|
586
|
+
inner: ""
|
|
587
|
+
};
|
|
588
|
+
n.prev = B, n.parens = I.parens, n.output = I.output;
|
|
589
|
+
let r = (f.capture ? "(" : "") + n.open;
|
|
590
|
+
Y("parens"), Z({
|
|
591
|
+
type: e,
|
|
592
|
+
value: t,
|
|
593
|
+
output: I.output ? "" : C
|
|
594
|
+
}), Z({
|
|
595
|
+
type: "paren",
|
|
596
|
+
extglob: !0,
|
|
597
|
+
value: W(),
|
|
598
|
+
output: r
|
|
599
|
+
}), L.push(n);
|
|
600
|
+
}, $ = (e) => {
|
|
601
|
+
let n = e.close + (f.capture ? ")" : ""), r;
|
|
602
|
+
if (e.type === "negate") {
|
|
603
|
+
let i = F;
|
|
604
|
+
e.inner && e.inner.length > 1 && e.inner.includes("/") && (i = M(f)), (i !== F || H() || /^\)+$/.test(G())) && (n = e.close = `)$))${i}`), e.inner.includes("*") && (r = G()) && /^\.[^\\/.]+$/.test(r) && (n = e.close = `)${d(r, {
|
|
605
|
+
...t,
|
|
606
|
+
fastpaths: !1
|
|
607
|
+
}).output})${i})`), e.prev.type === "bos" && (I.negatedExtglob = !0);
|
|
608
|
+
}
|
|
609
|
+
Z({
|
|
610
|
+
type: "paren",
|
|
611
|
+
extglob: !0,
|
|
612
|
+
value: V,
|
|
613
|
+
output: n
|
|
614
|
+
}), X("parens");
|
|
615
|
+
};
|
|
616
|
+
if (f.fastpaths !== !1 && !/(^[*!]|[/()[\]{}"])/.test(e)) {
|
|
617
|
+
let n = !1, i = e.replace(s, (e, t, r, i, a, o) => i === "\\" ? (n = !0, e) : i === "?" ? t ? t + i + (a ? O.repeat(a.length) : "") : o === 0 ? P + (a ? O.repeat(a.length) : "") : O.repeat(r.length) : i === "." ? b.repeat(r.length) : i === "*" ? t ? t + i + (a ? F : "") : F : t ? e : `\\${e}`);
|
|
618
|
+
return n === !0 && (i = f.unescape === !0 ? i.replace(/\\/g, "") : i.replace(/\\+/g, (e) => e.length % 2 == 0 ? "\\\\" : e ? "\\" : "")), i === e && f.contains === !0 ? (I.output = e, I) : (I.output = r.wrapOutput(i, I, t), I);
|
|
619
|
+
}
|
|
620
|
+
for (; !H();) {
|
|
621
|
+
if (V = W(), V === "\0") continue;
|
|
622
|
+
if (V === "\\") {
|
|
623
|
+
let e = U();
|
|
624
|
+
if (e === "/" && f.bash !== !0 || e === "." || e === ";") continue;
|
|
625
|
+
if (!e) {
|
|
626
|
+
V += "\\", Z({
|
|
627
|
+
type: "text",
|
|
628
|
+
value: V
|
|
629
|
+
});
|
|
630
|
+
continue;
|
|
631
|
+
}
|
|
632
|
+
let t = /^\\+/.exec(G()), n = 0;
|
|
633
|
+
if (t && t[0].length > 2 && (n = t[0].length, I.index += n, n % 2 != 0 && (V += "\\")), f.unescape === !0 ? V = W() : V += W(), I.brackets === 0) {
|
|
634
|
+
Z({
|
|
635
|
+
type: "text",
|
|
636
|
+
value: V
|
|
637
|
+
});
|
|
638
|
+
continue;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
if (I.brackets > 0 && (V !== "]" || B.value === "[" || B.value === "[^")) {
|
|
642
|
+
if (f.posix !== !1 && V === ":") {
|
|
643
|
+
let e = B.value.slice(1);
|
|
644
|
+
if (e.includes("[") && (B.posix = !0, e.includes(":"))) {
|
|
645
|
+
let e = B.value.lastIndexOf("["), t = B.value.slice(0, e), n = a[B.value.slice(e + 2)];
|
|
646
|
+
if (n) {
|
|
647
|
+
B.value = t + n, I.backtrack = !0, W(), !h.output && g.indexOf(B) === 1 && (h.output = C);
|
|
648
|
+
continue;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
(V === "[" && U() !== ":" || V === "-" && U() === "]") && (V = `\\${V}`), V === "]" && (B.value === "[" || B.value === "[^") && (V = `\\${V}`), f.posix === !0 && V === "!" && B.value === "[" && (V = "^"), B.value += V, q({ value: V });
|
|
653
|
+
continue;
|
|
654
|
+
}
|
|
655
|
+
if (I.quotes === 1 && V !== "\"") {
|
|
656
|
+
V = r.escapeRegex(V), B.value += V, q({ value: V });
|
|
657
|
+
continue;
|
|
658
|
+
}
|
|
659
|
+
if (V === "\"") {
|
|
660
|
+
I.quotes = I.quotes === 1 ? 0 : 1, f.keepQuotes === !0 && Z({
|
|
661
|
+
type: "text",
|
|
662
|
+
value: V
|
|
663
|
+
});
|
|
664
|
+
continue;
|
|
665
|
+
}
|
|
666
|
+
if (V === "(") {
|
|
667
|
+
Y("parens"), Z({
|
|
668
|
+
type: "paren",
|
|
669
|
+
value: V
|
|
670
|
+
});
|
|
671
|
+
continue;
|
|
672
|
+
}
|
|
673
|
+
if (V === ")") {
|
|
674
|
+
if (I.parens === 0 && f.strictBrackets === !0) throw SyntaxError(u("opening", "("));
|
|
675
|
+
let e = L[L.length - 1];
|
|
676
|
+
if (e && I.parens === e.parens + 1) {
|
|
677
|
+
$(L.pop());
|
|
678
|
+
continue;
|
|
679
|
+
}
|
|
680
|
+
Z({
|
|
681
|
+
type: "paren",
|
|
682
|
+
value: V,
|
|
683
|
+
output: I.parens ? ")" : "\\)"
|
|
684
|
+
}), X("parens");
|
|
685
|
+
continue;
|
|
686
|
+
}
|
|
687
|
+
if (V === "[") {
|
|
688
|
+
if (f.nobracket === !0 || !G().includes("]")) {
|
|
689
|
+
if (f.nobracket !== !0 && f.strictBrackets === !0) throw SyntaxError(u("closing", "]"));
|
|
690
|
+
V = `\\${V}`;
|
|
691
|
+
} else Y("brackets");
|
|
692
|
+
Z({
|
|
693
|
+
type: "bracket",
|
|
694
|
+
value: V
|
|
695
|
+
});
|
|
696
|
+
continue;
|
|
697
|
+
}
|
|
698
|
+
if (V === "]") {
|
|
699
|
+
if (f.nobracket === !0 || B && B.type === "bracket" && B.value.length === 1) {
|
|
700
|
+
Z({
|
|
701
|
+
type: "text",
|
|
702
|
+
value: V,
|
|
703
|
+
output: `\\${V}`
|
|
704
|
+
});
|
|
705
|
+
continue;
|
|
706
|
+
}
|
|
707
|
+
if (I.brackets === 0) {
|
|
708
|
+
if (f.strictBrackets === !0) throw SyntaxError(u("opening", "["));
|
|
709
|
+
Z({
|
|
710
|
+
type: "text",
|
|
711
|
+
value: V,
|
|
712
|
+
output: `\\${V}`
|
|
713
|
+
});
|
|
714
|
+
continue;
|
|
715
|
+
}
|
|
716
|
+
X("brackets");
|
|
717
|
+
let e = B.value.slice(1);
|
|
718
|
+
if (B.posix !== !0 && e[0] === "^" && !e.includes("/") && (V = `/${V}`), B.value += V, q({ value: V }), f.literalBrackets === !1 || r.hasRegexChars(e)) continue;
|
|
719
|
+
let t = r.escapeRegex(B.value);
|
|
720
|
+
if (I.output = I.output.slice(0, -B.value.length), f.literalBrackets === !0) {
|
|
721
|
+
I.output += t, B.value = t;
|
|
722
|
+
continue;
|
|
723
|
+
}
|
|
724
|
+
B.value = `(${_}${t}|${B.value})`, I.output += B.value;
|
|
725
|
+
continue;
|
|
726
|
+
}
|
|
727
|
+
if (V === "{" && f.nobrace !== !0) {
|
|
728
|
+
Y("braces");
|
|
729
|
+
let e = {
|
|
730
|
+
type: "brace",
|
|
731
|
+
value: V,
|
|
732
|
+
output: "(",
|
|
733
|
+
outputIndex: I.output.length,
|
|
734
|
+
tokensIndex: I.tokens.length
|
|
735
|
+
};
|
|
736
|
+
R.push(e), Z(e);
|
|
737
|
+
continue;
|
|
738
|
+
}
|
|
739
|
+
if (V === "}") {
|
|
740
|
+
let e = R[R.length - 1];
|
|
741
|
+
if (f.nobrace === !0 || !e) {
|
|
742
|
+
Z({
|
|
743
|
+
type: "text",
|
|
744
|
+
value: V,
|
|
745
|
+
output: V
|
|
746
|
+
});
|
|
747
|
+
continue;
|
|
748
|
+
}
|
|
749
|
+
let t = ")";
|
|
750
|
+
if (e.dots === !0) {
|
|
751
|
+
let e = g.slice(), n = [];
|
|
752
|
+
for (let t = e.length - 1; t >= 0 && (g.pop(), e[t].type !== "brace"); t--) e[t].type !== "dots" && n.unshift(e[t].value);
|
|
753
|
+
t = l(n, f), I.backtrack = !0;
|
|
754
|
+
}
|
|
755
|
+
if (e.comma !== !0 && e.dots !== !0) {
|
|
756
|
+
let n = I.output.slice(0, e.outputIndex), r = I.tokens.slice(e.tokensIndex);
|
|
757
|
+
e.value = e.output = "\\{", V = t = "\\}", I.output = n;
|
|
758
|
+
for (let e of r) I.output += e.output || e.value;
|
|
759
|
+
}
|
|
760
|
+
Z({
|
|
761
|
+
type: "brace",
|
|
762
|
+
value: V,
|
|
763
|
+
output: t
|
|
764
|
+
}), X("braces"), R.pop();
|
|
765
|
+
continue;
|
|
766
|
+
}
|
|
767
|
+
if (V === "|") {
|
|
768
|
+
L.length > 0 && L[L.length - 1].conditions++, Z({
|
|
769
|
+
type: "text",
|
|
770
|
+
value: V
|
|
771
|
+
});
|
|
772
|
+
continue;
|
|
773
|
+
}
|
|
774
|
+
if (V === ",") {
|
|
775
|
+
let e = V, t = R[R.length - 1];
|
|
776
|
+
t && z[z.length - 1] === "braces" && (t.comma = !0, e = "|"), Z({
|
|
777
|
+
type: "comma",
|
|
778
|
+
value: V,
|
|
779
|
+
output: e
|
|
780
|
+
});
|
|
781
|
+
continue;
|
|
782
|
+
}
|
|
783
|
+
if (V === "/") {
|
|
784
|
+
if (B.type === "dot" && I.index === I.start + 1) {
|
|
785
|
+
I.start = I.index + 1, I.consumed = "", I.output = "", g.pop(), B = h;
|
|
786
|
+
continue;
|
|
787
|
+
}
|
|
788
|
+
Z({
|
|
789
|
+
type: "slash",
|
|
790
|
+
value: V,
|
|
791
|
+
output: S
|
|
792
|
+
});
|
|
793
|
+
continue;
|
|
794
|
+
}
|
|
795
|
+
if (V === ".") {
|
|
796
|
+
if (I.braces > 0 && B.type === "dot") {
|
|
797
|
+
B.value === "." && (B.output = b);
|
|
798
|
+
let e = R[R.length - 1];
|
|
799
|
+
B.type = "dots", B.output += V, B.value += V, e.dots = !0;
|
|
800
|
+
continue;
|
|
801
|
+
}
|
|
802
|
+
if (I.braces + I.parens === 0 && B.type !== "bos" && B.type !== "slash") {
|
|
803
|
+
Z({
|
|
804
|
+
type: "text",
|
|
805
|
+
value: V,
|
|
806
|
+
output: b
|
|
807
|
+
});
|
|
808
|
+
continue;
|
|
809
|
+
}
|
|
810
|
+
Z({
|
|
811
|
+
type: "dot",
|
|
812
|
+
value: V,
|
|
813
|
+
output: b
|
|
814
|
+
});
|
|
815
|
+
continue;
|
|
816
|
+
}
|
|
817
|
+
if (V === "?") {
|
|
818
|
+
if (!(B && B.value === "(") && f.noextglob !== !0 && U() === "(" && U(2) !== "?") {
|
|
819
|
+
Q("qmark", V);
|
|
820
|
+
continue;
|
|
821
|
+
}
|
|
822
|
+
if (B && B.type === "paren") {
|
|
823
|
+
let e = U(), t = V;
|
|
824
|
+
(B.value === "(" && !/[!=<:]/.test(e) || e === "<" && !/<([!=]|\w+>)/.test(G())) && (t = `\\${V}`), Z({
|
|
825
|
+
type: "text",
|
|
826
|
+
value: V,
|
|
827
|
+
output: t
|
|
828
|
+
});
|
|
829
|
+
continue;
|
|
830
|
+
}
|
|
831
|
+
if (f.dot !== !0 && (B.type === "slash" || B.type === "bos")) {
|
|
832
|
+
Z({
|
|
833
|
+
type: "qmark",
|
|
834
|
+
value: V,
|
|
835
|
+
output: k
|
|
836
|
+
});
|
|
837
|
+
continue;
|
|
838
|
+
}
|
|
839
|
+
Z({
|
|
840
|
+
type: "qmark",
|
|
841
|
+
value: V,
|
|
842
|
+
output: O
|
|
843
|
+
});
|
|
844
|
+
continue;
|
|
845
|
+
}
|
|
846
|
+
if (V === "!") {
|
|
847
|
+
if (f.noextglob !== !0 && U() === "(" && (U(2) !== "?" || !/[!=<:]/.test(U(3)))) {
|
|
848
|
+
Q("negate", V);
|
|
849
|
+
continue;
|
|
850
|
+
}
|
|
851
|
+
if (f.nonegate !== !0 && I.index === 0) {
|
|
852
|
+
J();
|
|
853
|
+
continue;
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
if (V === "+") {
|
|
857
|
+
if (f.noextglob !== !0 && U() === "(" && U(2) !== "?") {
|
|
858
|
+
Q("plus", V);
|
|
859
|
+
continue;
|
|
860
|
+
}
|
|
861
|
+
if (B && B.value === "(" || f.regex === !1) {
|
|
862
|
+
Z({
|
|
863
|
+
type: "plus",
|
|
864
|
+
value: V,
|
|
865
|
+
output: x
|
|
866
|
+
});
|
|
867
|
+
continue;
|
|
868
|
+
}
|
|
869
|
+
if (B && (B.type === "bracket" || B.type === "paren" || B.type === "brace") || I.parens > 0) {
|
|
870
|
+
Z({
|
|
871
|
+
type: "plus",
|
|
872
|
+
value: V
|
|
873
|
+
});
|
|
874
|
+
continue;
|
|
875
|
+
}
|
|
876
|
+
Z({
|
|
877
|
+
type: "plus",
|
|
878
|
+
value: x
|
|
879
|
+
});
|
|
880
|
+
continue;
|
|
881
|
+
}
|
|
882
|
+
if (V === "@") {
|
|
883
|
+
if (f.noextglob !== !0 && U() === "(" && U(2) !== "?") {
|
|
884
|
+
Z({
|
|
885
|
+
type: "at",
|
|
886
|
+
extglob: !0,
|
|
887
|
+
value: V,
|
|
888
|
+
output: ""
|
|
889
|
+
});
|
|
890
|
+
continue;
|
|
891
|
+
}
|
|
892
|
+
Z({
|
|
893
|
+
type: "text",
|
|
894
|
+
value: V
|
|
895
|
+
});
|
|
896
|
+
continue;
|
|
897
|
+
}
|
|
898
|
+
if (V !== "*") {
|
|
899
|
+
(V === "$" || V === "^") && (V = `\\${V}`);
|
|
900
|
+
let e = o.exec(G());
|
|
901
|
+
e && (V += e[0], I.index += e[0].length), Z({
|
|
902
|
+
type: "text",
|
|
903
|
+
value: V
|
|
904
|
+
});
|
|
905
|
+
continue;
|
|
906
|
+
}
|
|
907
|
+
if (B && (B.type === "globstar" || B.star === !0)) {
|
|
908
|
+
B.type = "star", B.star = !0, B.value += V, B.output = F, I.backtrack = !0, I.globstar = !0, K(V);
|
|
909
|
+
continue;
|
|
910
|
+
}
|
|
911
|
+
let t = G();
|
|
912
|
+
if (f.noextglob !== !0 && /^\([^?]/.test(t)) {
|
|
913
|
+
Q("star", V);
|
|
914
|
+
continue;
|
|
915
|
+
}
|
|
916
|
+
if (B.type === "star") {
|
|
917
|
+
if (f.noglobstar === !0) {
|
|
918
|
+
K(V);
|
|
919
|
+
continue;
|
|
920
|
+
}
|
|
921
|
+
let n = B.prev, r = n.prev, i = n.type === "slash" || n.type === "bos", a = r && (r.type === "star" || r.type === "globstar");
|
|
922
|
+
if (f.bash === !0 && (!i || t[0] && t[0] !== "/")) {
|
|
923
|
+
Z({
|
|
924
|
+
type: "star",
|
|
925
|
+
value: V,
|
|
926
|
+
output: ""
|
|
927
|
+
});
|
|
928
|
+
continue;
|
|
929
|
+
}
|
|
930
|
+
let o = I.braces > 0 && (n.type === "comma" || n.type === "brace"), s = L.length && (n.type === "pipe" || n.type === "paren");
|
|
931
|
+
if (!i && n.type !== "paren" && !o && !s) {
|
|
932
|
+
Z({
|
|
933
|
+
type: "star",
|
|
934
|
+
value: V,
|
|
935
|
+
output: ""
|
|
936
|
+
});
|
|
937
|
+
continue;
|
|
938
|
+
}
|
|
939
|
+
for (; t.slice(0, 3) === "/**";) {
|
|
940
|
+
let n = e[I.index + 4];
|
|
941
|
+
if (n && n !== "/") break;
|
|
942
|
+
t = t.slice(3), K("/**", 3);
|
|
943
|
+
}
|
|
944
|
+
if (n.type === "bos" && H()) {
|
|
945
|
+
B.type = "globstar", B.value += V, B.output = M(f), I.output = B.output, I.globstar = !0, K(V);
|
|
946
|
+
continue;
|
|
947
|
+
}
|
|
948
|
+
if (n.type === "slash" && n.prev.type !== "bos" && !a && H()) {
|
|
949
|
+
I.output = I.output.slice(0, -(n.output + B.output).length), n.output = `(?:${n.output}`, B.type = "globstar", B.output = M(f) + (f.strictSlashes ? ")" : "|$)"), B.value += V, I.globstar = !0, I.output += n.output + B.output, K(V);
|
|
950
|
+
continue;
|
|
951
|
+
}
|
|
952
|
+
if (n.type === "slash" && n.prev.type !== "bos" && t[0] === "/") {
|
|
953
|
+
let e = t[1] === void 0 ? "" : "|$";
|
|
954
|
+
I.output = I.output.slice(0, -(n.output + B.output).length), n.output = `(?:${n.output}`, B.type = "globstar", B.output = `${M(f)}${S}|${S}${e})`, B.value += V, I.output += n.output + B.output, I.globstar = !0, K(V + W()), Z({
|
|
955
|
+
type: "slash",
|
|
956
|
+
value: "/",
|
|
957
|
+
output: ""
|
|
958
|
+
});
|
|
959
|
+
continue;
|
|
960
|
+
}
|
|
961
|
+
if (n.type === "bos" && t[0] === "/") {
|
|
962
|
+
B.type = "globstar", B.value += V, B.output = `(?:^|${S}|${M(f)}${S})`, I.output = B.output, I.globstar = !0, K(V + W()), Z({
|
|
963
|
+
type: "slash",
|
|
964
|
+
value: "/",
|
|
965
|
+
output: ""
|
|
966
|
+
});
|
|
967
|
+
continue;
|
|
968
|
+
}
|
|
969
|
+
I.output = I.output.slice(0, -B.output.length), B.type = "globstar", B.output = M(f), B.value += V, I.output += B.output, I.globstar = !0, K(V);
|
|
970
|
+
continue;
|
|
971
|
+
}
|
|
972
|
+
let n = {
|
|
973
|
+
type: "star",
|
|
974
|
+
value: V,
|
|
975
|
+
output: F
|
|
976
|
+
};
|
|
977
|
+
if (f.bash === !0) {
|
|
978
|
+
n.output = ".*?", (B.type === "bos" || B.type === "slash") && (n.output = N + n.output), Z(n);
|
|
979
|
+
continue;
|
|
980
|
+
}
|
|
981
|
+
if (B && (B.type === "bracket" || B.type === "paren") && f.regex === !0) {
|
|
982
|
+
n.output = V, Z(n);
|
|
983
|
+
continue;
|
|
984
|
+
}
|
|
985
|
+
(I.index === I.start || B.type === "slash" || B.type === "dot") && (B.type === "dot" ? (I.output += E, B.output += E) : f.dot === !0 ? (I.output += D, B.output += D) : (I.output += N, B.output += N), U() !== "*" && (I.output += C, B.output += C)), Z(n);
|
|
986
|
+
}
|
|
987
|
+
for (; I.brackets > 0;) {
|
|
988
|
+
if (f.strictBrackets === !0) throw SyntaxError(u("closing", "]"));
|
|
989
|
+
I.output = r.escapeLast(I.output, "["), X("brackets");
|
|
990
|
+
}
|
|
991
|
+
for (; I.parens > 0;) {
|
|
992
|
+
if (f.strictBrackets === !0) throw SyntaxError(u("closing", ")"));
|
|
993
|
+
I.output = r.escapeLast(I.output, "("), X("parens");
|
|
994
|
+
}
|
|
995
|
+
for (; I.braces > 0;) {
|
|
996
|
+
if (f.strictBrackets === !0) throw SyntaxError(u("closing", "}"));
|
|
997
|
+
I.output = r.escapeLast(I.output, "{"), X("braces");
|
|
998
|
+
}
|
|
999
|
+
if (f.strictSlashes !== !0 && (B.type === "star" || B.type === "bracket") && Z({
|
|
1000
|
+
type: "maybe_slash",
|
|
1001
|
+
value: "",
|
|
1002
|
+
output: `${S}?`
|
|
1003
|
+
}), I.backtrack === !0) {
|
|
1004
|
+
I.output = "";
|
|
1005
|
+
for (let e of I.tokens) I.output += e.output == null ? e.value : e.output, e.suffix && (I.output += e.suffix);
|
|
1006
|
+
}
|
|
1007
|
+
return I;
|
|
1008
|
+
};
|
|
1009
|
+
d.fastpaths = (e, t) => {
|
|
1010
|
+
let a = { ...t }, o = typeof a.maxLength == "number" ? Math.min(i, a.maxLength) : i, s = e.length;
|
|
1011
|
+
if (s > o) throw SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${o}`);
|
|
1012
|
+
e = c[e] || e;
|
|
1013
|
+
let { DOT_LITERAL: l, SLASH_LITERAL: u, ONE_CHAR: d, DOTS_SLASH: f, NO_DOT: p, NO_DOTS: m, NO_DOTS_SLASH: h, STAR: g, START_ANCHOR: _ } = n.globChars(a.windows), v = a.dot ? m : p, y = a.dot ? h : p, b = a.capture ? "" : "?:", x = {
|
|
1014
|
+
negated: !1,
|
|
1015
|
+
prefix: ""
|
|
1016
|
+
}, S = a.bash === !0 ? ".*?" : g;
|
|
1017
|
+
a.capture && (S = `(${S})`);
|
|
1018
|
+
let C = (e) => e.noglobstar === !0 ? S : `(${b}(?:(?!${_}${e.dot ? f : l}).)*?)`, w = (e) => {
|
|
1019
|
+
switch (e) {
|
|
1020
|
+
case "*": return `${v}${d}${S}`;
|
|
1021
|
+
case ".*": return `${l}${d}${S}`;
|
|
1022
|
+
case "*.*": return `${v}${S}${l}${d}${S}`;
|
|
1023
|
+
case "*/*": return `${v}${S}${u}${d}${y}${S}`;
|
|
1024
|
+
case "**": return v + C(a);
|
|
1025
|
+
case "**/*": return `(?:${v}${C(a)}${u})?${y}${d}${S}`;
|
|
1026
|
+
case "**/*.*": return `(?:${v}${C(a)}${u})?${y}${S}${l}${d}${S}`;
|
|
1027
|
+
case "**/.*": return `(?:${v}${C(a)}${u})?${l}${d}${S}`;
|
|
1028
|
+
default: {
|
|
1029
|
+
let t = /^(.*?)\.(\w+)$/.exec(e);
|
|
1030
|
+
if (!t) return;
|
|
1031
|
+
let n = w(t[1]);
|
|
1032
|
+
return n ? n + l + t[2] : void 0;
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
}, T = w(r.removePrefix(e, x));
|
|
1036
|
+
return T && a.strictSlashes !== !0 && (T += `${u}?`), T;
|
|
1037
|
+
}, t.exports = d;
|
|
1038
|
+
})), T = /* @__PURE__ */ e(((e, t) => {
|
|
1039
|
+
var n = C(), r = w(), i = S(), a = x(), o = (e) => e && typeof e == "object" && !Array.isArray(e), s = (e, t, n = !1) => {
|
|
1040
|
+
if (Array.isArray(e)) {
|
|
1041
|
+
let r = e.map((e) => s(e, t, n));
|
|
1042
|
+
return (e) => {
|
|
1043
|
+
for (let t of r) {
|
|
1044
|
+
let n = t(e);
|
|
1045
|
+
if (n) return n;
|
|
1046
|
+
}
|
|
1047
|
+
return !1;
|
|
1048
|
+
};
|
|
1049
|
+
}
|
|
1050
|
+
let r = o(e) && e.tokens && e.input;
|
|
1051
|
+
if (e === "" || typeof e != "string" && !r) throw TypeError("Expected pattern to be a non-empty string");
|
|
1052
|
+
let i = t || {}, a = i.windows, c = r ? s.compileRe(e, t) : s.makeRe(e, t, !1, !0), l = c.state;
|
|
1053
|
+
delete c.state;
|
|
1054
|
+
let u = () => !1;
|
|
1055
|
+
if (i.ignore) {
|
|
1056
|
+
let e = {
|
|
1057
|
+
...t,
|
|
1058
|
+
ignore: null,
|
|
1059
|
+
onMatch: null,
|
|
1060
|
+
onResult: null
|
|
1061
|
+
};
|
|
1062
|
+
u = s(i.ignore, e, n);
|
|
1063
|
+
}
|
|
1064
|
+
let d = (n, r = !1) => {
|
|
1065
|
+
let { isMatch: o, match: d, output: f } = s.test(n, c, t, {
|
|
1066
|
+
glob: e,
|
|
1067
|
+
posix: a
|
|
1068
|
+
}), p = {
|
|
1069
|
+
glob: e,
|
|
1070
|
+
state: l,
|
|
1071
|
+
regex: c,
|
|
1072
|
+
posix: a,
|
|
1073
|
+
input: n,
|
|
1074
|
+
output: f,
|
|
1075
|
+
match: d,
|
|
1076
|
+
isMatch: o
|
|
1077
|
+
};
|
|
1078
|
+
return typeof i.onResult == "function" && i.onResult(p), o === !1 ? (p.isMatch = !1, r ? p : !1) : u(n) ? (typeof i.onIgnore == "function" && i.onIgnore(p), p.isMatch = !1, r ? p : !1) : (typeof i.onMatch == "function" && i.onMatch(p), r ? p : !0);
|
|
1079
|
+
};
|
|
1080
|
+
return n && (d.state = l), d;
|
|
1081
|
+
};
|
|
1082
|
+
s.test = (e, t, n, { glob: r, posix: a } = {}) => {
|
|
1083
|
+
if (typeof e != "string") throw TypeError("Expected input to be a string");
|
|
1084
|
+
if (e === "") return {
|
|
1085
|
+
isMatch: !1,
|
|
1086
|
+
output: ""
|
|
1087
|
+
};
|
|
1088
|
+
let o = n || {}, c = o.format || (a ? i.toPosixSlashes : null), l = e === r, u = l && c ? c(e) : e;
|
|
1089
|
+
return l === !1 && (u = c ? c(e) : e, l = u === r), (l === !1 || o.capture === !0) && (l = o.matchBase === !0 || o.basename === !0 ? s.matchBase(e, t, n, a) : t.exec(u)), {
|
|
1090
|
+
isMatch: !!l,
|
|
1091
|
+
match: l,
|
|
1092
|
+
output: u
|
|
1093
|
+
};
|
|
1094
|
+
}, s.matchBase = (e, t, n) => (t instanceof RegExp ? t : s.makeRe(t, n)).test(i.basename(e)), s.isMatch = (e, t, n) => s(t, n)(e), s.parse = (e, t) => Array.isArray(e) ? e.map((e) => s.parse(e, t)) : r(e, {
|
|
1095
|
+
...t,
|
|
1096
|
+
fastpaths: !1
|
|
1097
|
+
}), s.scan = (e, t) => n(e, t), s.compileRe = (e, t, n = !1, r = !1) => {
|
|
1098
|
+
if (n === !0) return e.output;
|
|
1099
|
+
let i = t || {}, a = i.contains ? "" : "^", o = i.contains ? "" : "$", c = `${a}(?:${e.output})${o}`;
|
|
1100
|
+
e && e.negated === !0 && (c = `^(?!${c}).*$`);
|
|
1101
|
+
let l = s.toRegex(c, t);
|
|
1102
|
+
return r === !0 && (l.state = e), l;
|
|
1103
|
+
}, s.makeRe = (e, t = {}, n = !1, i = !1) => {
|
|
1104
|
+
if (!e || typeof e != "string") throw TypeError("Expected a non-empty string");
|
|
1105
|
+
let a = {
|
|
1106
|
+
negated: !1,
|
|
1107
|
+
fastpaths: !0
|
|
1108
|
+
};
|
|
1109
|
+
return t.fastpaths !== !1 && (e[0] === "." || e[0] === "*") && (a.output = r.fastpaths(e, t)), a.output || (a = r(e, t)), s.compileRe(a, t, n, i);
|
|
1110
|
+
}, s.toRegex = (e, t) => {
|
|
1111
|
+
try {
|
|
1112
|
+
let n = t || {};
|
|
1113
|
+
return new RegExp(e, n.flags || (n.nocase ? "i" : ""));
|
|
1114
|
+
} catch (e) {
|
|
1115
|
+
if (t && t.debug === !0) throw e;
|
|
1116
|
+
return /$^/;
|
|
1117
|
+
}
|
|
1118
|
+
}, s.constants = a, t.exports = s;
|
|
1119
|
+
})), E = /* @__PURE__ */ e(((e, t) => {
|
|
1120
|
+
var n = T(), r = S();
|
|
1121
|
+
function i(e, t, i = !1) {
|
|
1122
|
+
return t && (t.windows === null || t.windows === void 0) && (t = {
|
|
1123
|
+
...t,
|
|
1124
|
+
windows: r.isWindows()
|
|
1125
|
+
}), n(e, t, i);
|
|
1126
|
+
}
|
|
1127
|
+
Object.assign(i, n), t.exports = i;
|
|
1128
|
+
})), D = null;
|
|
1129
|
+
function O(e, t) {
|
|
1130
|
+
if (!t || t.length === 0) return [c(e, "src")];
|
|
1131
|
+
let n = /* @__PURE__ */ new Set();
|
|
1132
|
+
for (let e of t) {
|
|
1133
|
+
let t = e.replace(/^\.\//, "").split("*")[0].replace(/\/+$/, "");
|
|
1134
|
+
n.add(t || ".");
|
|
1135
|
+
}
|
|
1136
|
+
return [...n].map((t) => c(e, t));
|
|
1137
|
+
}
|
|
1138
|
+
function k(e) {
|
|
1139
|
+
D && D();
|
|
1140
|
+
let { cwd: t, compiledDir: n, delay: i = 1e3, include: a, exclude: o, parallelCompile: s } = e, l = c(t, n), u = E(), d = o?.length ? u(o) : () => !1, f = { cwd: t };
|
|
1141
|
+
s && (f.parallelCompile = !0);
|
|
1142
|
+
let p = b(f, i);
|
|
1143
|
+
p();
|
|
1144
|
+
let m = O(t, a).map((e) => r(e, { recursive: !0 }, (t, n) => {
|
|
1145
|
+
n && /\.[jt]sx?$/.test(n) && (n.includes("node_modules") || n.includes(".next") || c(e, n).startsWith(l) || d(n) || p());
|
|
1146
|
+
})), h = () => {
|
|
1147
|
+
for (let e of m) e.close();
|
|
1148
|
+
D = null;
|
|
1149
|
+
};
|
|
1150
|
+
return D = h, h;
|
|
1151
|
+
}
|
|
1152
|
+
//#endregion
|
|
200
1153
|
//#region src/with-fluenti.ts
|
|
201
|
-
function
|
|
202
|
-
if (e &&
|
|
1154
|
+
function A(e) {
|
|
1155
|
+
if (e && !j(e)) return M({}, e);
|
|
203
1156
|
let t = e ?? {};
|
|
204
1157
|
return function(e) {
|
|
205
|
-
return
|
|
1158
|
+
return M(t, e ?? {});
|
|
206
1159
|
};
|
|
207
1160
|
}
|
|
208
|
-
function
|
|
1161
|
+
function j(e) {
|
|
209
1162
|
return [
|
|
210
|
-
"
|
|
211
|
-
"
|
|
212
|
-
"
|
|
213
|
-
"
|
|
214
|
-
"
|
|
215
|
-
"
|
|
216
|
-
"redirects",
|
|
217
|
-
"headers",
|
|
218
|
-
"pageExtensions",
|
|
219
|
-
"output",
|
|
220
|
-
"basePath",
|
|
221
|
-
"i18n",
|
|
222
|
-
"trailingSlash",
|
|
223
|
-
"compiler",
|
|
224
|
-
"transpilePackages"
|
|
1163
|
+
"config",
|
|
1164
|
+
"serverModule",
|
|
1165
|
+
"serverModuleOutDir",
|
|
1166
|
+
"resolveLocale",
|
|
1167
|
+
"cookieName",
|
|
1168
|
+
"loaderEnforce"
|
|
225
1169
|
].some((t) => t in e);
|
|
226
1170
|
}
|
|
227
|
-
function
|
|
228
|
-
let r = process.cwd(), i =
|
|
229
|
-
|
|
230
|
-
let
|
|
1171
|
+
function M(e, n) {
|
|
1172
|
+
let r = process.cwd(), i = h(r, e), o = i.fluentiConfig, s = o.compileOutDir;
|
|
1173
|
+
t(c(r, s)) || console.warn(`\n[fluenti] Compiled catalogs not found at ${s}.\nRun: npx fluenti extract && npx fluenti compile\n`);
|
|
1174
|
+
let l = g(r, i), u = c(typeof __dirname < "u" ? __dirname : a(new URL(import.meta.url).pathname), "loader.js"), d = n.webpack, f = !1, p = Object.fromEntries([
|
|
1175
|
+
"*.ts",
|
|
1176
|
+
"*.tsx",
|
|
1177
|
+
"*.js",
|
|
1178
|
+
"*.jsx"
|
|
1179
|
+
].map((e) => [e, {
|
|
1180
|
+
condition: { not: "foreign" },
|
|
1181
|
+
loaders: ["@fluenti/next/loader"]
|
|
1182
|
+
}])), m = "./" + l.replace(r + "/", "").replace(r + "\\", ""), _ = { "@fluenti/next": m }, v = process.env.NODE_ENV === "development" || process.argv.some((e) => e === "dev"), y = o.devAutoCompile ?? !0;
|
|
1183
|
+
if (v && y) {
|
|
1184
|
+
let e = {
|
|
1185
|
+
cwd: r,
|
|
1186
|
+
compiledDir: s,
|
|
1187
|
+
delay: o.devAutoCompileDelay ?? 1e3
|
|
1188
|
+
};
|
|
1189
|
+
o.parallelCompile && (e.parallelCompile = !0), o.include && (e.include = o.include), o.exclude && (e.exclude = o.exclude), k(e);
|
|
1190
|
+
}
|
|
231
1191
|
return {
|
|
232
1192
|
...n,
|
|
233
|
-
|
|
234
|
-
|
|
1193
|
+
turbopack: N(n.turbopack, {
|
|
1194
|
+
rules: p,
|
|
1195
|
+
resolveAlias: _
|
|
1196
|
+
}),
|
|
1197
|
+
webpack(t, n) {
|
|
1198
|
+
let i = e.loaderEnforce === void 0 && !("loaderEnforce" in e) ? "pre" : e.loaderEnforce;
|
|
1199
|
+
t.module.rules.push({
|
|
235
1200
|
test: /\.[jt]sx?$/,
|
|
236
|
-
enforce:
|
|
1201
|
+
...i ? { enforce: i } : {},
|
|
237
1202
|
exclude: [/node_modules/, /\.next/],
|
|
238
1203
|
use: [{
|
|
239
|
-
loader:
|
|
240
|
-
options: { serverModulePath:
|
|
1204
|
+
loader: u,
|
|
1205
|
+
options: { serverModulePath: l }
|
|
241
1206
|
}]
|
|
242
|
-
}),
|
|
243
|
-
let
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
1207
|
+
}), t.resolve = t.resolve ?? {}, t.resolve.alias = t.resolve.alias ?? {}, t.resolve.alias["@fluenti/next$"] = l;
|
|
1208
|
+
let a = o.buildAutoCompile ?? !0;
|
|
1209
|
+
return !n.dev && a && (t.plugins = t.plugins ?? [], t.plugins.push({ apply(e) {
|
|
1210
|
+
e.hooks.beforeRun.tapPromise("fluenti-compile", async () => {
|
|
1211
|
+
if (!f) {
|
|
1212
|
+
f = !0;
|
|
1213
|
+
try {
|
|
1214
|
+
let { runCompile: e } = await import("@fluenti/cli");
|
|
1215
|
+
await e(r, o.parallelCompile ? { parallel: !0 } : void 0);
|
|
1216
|
+
} catch {}
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
} })), d ? d(t, n) : t;
|
|
1220
|
+
}
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
function N(e, t) {
|
|
1224
|
+
let n = e ?? {}, r = n.rules ?? {}, i = Object.keys(t.rules).filter((e) => e in r);
|
|
1225
|
+
return i.length > 0 && console.warn(`[fluenti] Your turbopack.rules override Fluenti's loader for: ${i.join(", ")}.\n Fluenti's t\`\` transform will NOT run on these file types.\n If this is intentional, you can suppress this warning with { devAutoCompile: false }.`), {
|
|
1226
|
+
...n,
|
|
1227
|
+
rules: {
|
|
1228
|
+
...t.rules,
|
|
1229
|
+
...r
|
|
1230
|
+
},
|
|
1231
|
+
resolveAlias: {
|
|
1232
|
+
...t.resolveAlias,
|
|
1233
|
+
...n.resolveAlias
|
|
266
1234
|
}
|
|
267
1235
|
};
|
|
268
1236
|
}
|
|
269
1237
|
//#endregion
|
|
270
1238
|
//#region src/index.ts
|
|
271
|
-
var
|
|
272
|
-
function
|
|
273
|
-
throw Error(
|
|
1239
|
+
var P = "[fluenti] `withFluenti()` must be configured in next.config.ts before importing from \"@fluenti/next\".";
|
|
1240
|
+
function F() {
|
|
1241
|
+
throw Error(P);
|
|
274
1242
|
}
|
|
275
|
-
var
|
|
1243
|
+
var I = F, L = F, R = F, z = F, B = F, V = F, H = F, U = F, W = F;
|
|
276
1244
|
//#endregion
|
|
277
|
-
export {
|
|
1245
|
+
export { H as DateTime, W as I18nProvider, U as NumberFormat, B as Plural, V as Select, z as Trans, L as getI18n, I as setLocale, R as t, A as withFluenti };
|
|
278
1246
|
|
|
279
1247
|
//# sourceMappingURL=index.js.map
|