@powerlines/plugin-rspack 0.5.136 → 0.5.138
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/_virtual/rolldown_runtime.cjs +2 -0
- package/dist/_virtual/rolldown_runtime.mjs +32 -0
- package/dist/helpers/unplugin.cjs +3 -4
- package/dist/helpers/unplugin.mjs +2 -3
- package/dist/index.cjs +4 -4
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +4 -4
- package/dist/node_modules/.pnpm/@jridgewell_gen-mapping@0.3.13/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.cjs +2 -0
- package/dist/node_modules/.pnpm/@jridgewell_gen-mapping@0.3.13/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs +4 -0
- package/dist/node_modules/.pnpm/@jridgewell_remapping@2.3.5/node_modules/@jridgewell/remapping/dist/remapping.cjs +2 -0
- package/dist/node_modules/.pnpm/@jridgewell_remapping@2.3.5/node_modules/@jridgewell/remapping/dist/remapping.mjs +4 -0
- package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.cjs +15 -0
- package/dist/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +15 -0
- package/dist/node_modules/.pnpm/@jridgewell_trace-mapping@0.3.31/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.cjs +1 -0
- package/dist/node_modules/.pnpm/@jridgewell_trace-mapping@0.3.31/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs +3 -0
- package/dist/node_modules/.pnpm/@storm-software_config-tools@1.188.75_magicast@0.5.1/node_modules/@storm-software/config-tools/dist/chunk-POXTJ6GF.cjs +16 -0
- package/dist/node_modules/.pnpm/@storm-software_config-tools@1.188.75_magicast@0.5.1/node_modules/@storm-software/config-tools/dist/chunk-POXTJ6GF.mjs +15 -0
- package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.cjs +28 -0
- package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.mjs +23 -0
- package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.cjs +175 -0
- package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/constants.mjs +170 -0
- package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.cjs +871 -0
- package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/parse.mjs +866 -0
- package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.cjs +307 -0
- package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.mjs +302 -0
- package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.cjs +300 -0
- package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.mjs +295 -0
- package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.cjs +60 -0
- package/dist/node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.mjs +55 -0
- package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/context-CehLHpzV.cjs +46 -0
- package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/context-CehLHpzV.mjs +44 -0
- package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/index.cjs +142 -0
- package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/index.mjs +140 -0
- package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/parse-CRORloGP.cjs +114 -0
- package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/parse-CRORloGP.mjs +112 -0
- package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/utils-CuyC8gTr.cjs +59 -0
- package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/utils-CuyC8gTr.mjs +54 -0
- package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/webpack-like-BU9ULG6P.cjs +35 -0
- package/dist/node_modules/.pnpm/unplugin@3.0.0-beta.3/node_modules/unplugin/dist/webpack-like-BU9ULG6P.mjs +33 -0
- package/dist/node_modules/.pnpm/webpack-virtual-modules@0.6.2/node_modules/webpack-virtual-modules/lib/index.cjs +236 -0
- package/dist/node_modules/.pnpm/webpack-virtual-modules@0.6.2/node_modules/webpack-virtual-modules/lib/index.mjs +231 -0
- package/dist/node_modules/.pnpm/webpack-virtual-modules@0.6.2/node_modules/webpack-virtual-modules/lib/virtual-stats.cjs +54 -0
- package/dist/node_modules/.pnpm/webpack-virtual-modules@0.6.2/node_modules/webpack-virtual-modules/lib/virtual-stats.mjs +49 -0
- package/dist/{powerlines → packages/powerlines}/src/types/config.d.mts +2 -4
- package/dist/{powerlines → packages/powerlines}/src/types/context.d.mts +5 -5
- package/dist/{powerlines → packages/powerlines}/src/types/fs.d.mts +1 -1
- package/dist/{powerlines → packages/powerlines}/src/types/tsconfig.d.mts +1 -1
- package/dist/types/plugin.d.mts +3 -3
- package/package.json +4 -5
- package/dist/powerlines/schemas/fs.cjs +0 -226
- package/dist/powerlines/schemas/fs.mjs +0 -224
- package/dist/powerlines/src/api.cjs +0 -580
- package/dist/powerlines/src/api.mjs +0 -578
- package/dist/powerlines/src/internal/babel/module-resolver-plugin.cjs +0 -86
- package/dist/powerlines/src/internal/babel/module-resolver-plugin.mjs +0 -84
- package/dist/powerlines/src/internal/helpers/environment.cjs +0 -52
- package/dist/powerlines/src/internal/helpers/environment.mjs +0 -48
- package/dist/powerlines/src/internal/helpers/generate-types.cjs +0 -51
- package/dist/powerlines/src/internal/helpers/generate-types.mjs +0 -49
- package/dist/powerlines/src/internal/helpers/hooks.cjs +0 -66
- package/dist/powerlines/src/internal/helpers/hooks.mjs +0 -64
- package/dist/powerlines/src/internal/helpers/install-dependencies.cjs +0 -25
- package/dist/powerlines/src/internal/helpers/install-dependencies.mjs +0 -24
- package/dist/powerlines/src/internal/helpers/install.cjs +0 -37
- package/dist/powerlines/src/internal/helpers/install.mjs +0 -36
- package/dist/powerlines/src/internal/helpers/resolve-tsconfig.cjs +0 -98
- package/dist/powerlines/src/internal/helpers/resolve-tsconfig.mjs +0 -94
- package/dist/powerlines/src/internal/helpers/resolver.cjs +0 -43
- package/dist/powerlines/src/internal/helpers/resolver.mjs +0 -41
- package/dist/powerlines/src/lib/build/rspack.cjs +0 -43
- package/dist/powerlines/src/lib/build/rspack.mjs +0 -41
- package/dist/powerlines/src/lib/config-file.cjs +0 -79
- package/dist/powerlines/src/lib/config-file.mjs +0 -76
- package/dist/powerlines/src/lib/contexts/api-context.cjs +0 -184
- package/dist/powerlines/src/lib/contexts/api-context.mjs +0 -182
- package/dist/powerlines/src/lib/contexts/context.cjs +0 -933
- package/dist/powerlines/src/lib/contexts/context.mjs +0 -931
- package/dist/powerlines/src/lib/contexts/environment-context.cjs +0 -195
- package/dist/powerlines/src/lib/contexts/environment-context.mjs +0 -194
- package/dist/powerlines/src/lib/contexts/plugin-context.cjs +0 -75
- package/dist/powerlines/src/lib/contexts/plugin-context.mjs +0 -74
- package/dist/powerlines/src/lib/entry.cjs +0 -69
- package/dist/powerlines/src/lib/entry.mjs +0 -67
- package/dist/powerlines/src/lib/fs/helpers.cjs +0 -85
- package/dist/powerlines/src/lib/fs/helpers.mjs +0 -81
- package/dist/powerlines/src/lib/fs/storage/base.cjs +0 -196
- package/dist/powerlines/src/lib/fs/storage/base.mjs +0 -195
- package/dist/powerlines/src/lib/fs/storage/file-system.cjs +0 -170
- package/dist/powerlines/src/lib/fs/storage/file-system.mjs +0 -169
- package/dist/powerlines/src/lib/fs/storage/virtual.cjs +0 -88
- package/dist/powerlines/src/lib/fs/storage/virtual.mjs +0 -87
- package/dist/powerlines/src/lib/fs/vfs.cjs +0 -830
- package/dist/powerlines/src/lib/fs/vfs.mjs +0 -828
- package/dist/powerlines/src/lib/logger.cjs +0 -58
- package/dist/powerlines/src/lib/logger.mjs +0 -55
- package/dist/powerlines/src/lib/typescript/ts-morph.cjs +0 -104
- package/dist/powerlines/src/lib/typescript/ts-morph.mjs +0 -102
- package/dist/powerlines/src/lib/typescript/tsconfig.cjs +0 -149
- package/dist/powerlines/src/lib/typescript/tsconfig.mjs +0 -144
- package/dist/powerlines/src/lib/unplugin/factory.cjs +0 -6
- package/dist/powerlines/src/lib/unplugin/factory.mjs +0 -8
- package/dist/powerlines/src/lib/unplugin/helpers.cjs +0 -29
- package/dist/powerlines/src/lib/unplugin/helpers.mjs +0 -27
- package/dist/powerlines/src/lib/unplugin/index.cjs +0 -3
- package/dist/powerlines/src/lib/unplugin/index.mjs +0 -5
- package/dist/powerlines/src/lib/unplugin/plugin.cjs +0 -128
- package/dist/powerlines/src/lib/unplugin/plugin.mjs +0 -127
- package/dist/powerlines/src/lib/utilities/file-header.cjs +0 -22
- package/dist/powerlines/src/lib/utilities/file-header.mjs +0 -21
- package/dist/powerlines/src/lib/utilities/meta.cjs +0 -45
- package/dist/powerlines/src/lib/utilities/meta.mjs +0 -41
- package/dist/powerlines/src/lib/utilities/source-file.cjs +0 -22
- package/dist/powerlines/src/lib/utilities/source-file.mjs +0 -21
- package/dist/powerlines/src/plugin-utils/helpers.cjs +0 -167
- package/dist/powerlines/src/plugin-utils/helpers.mjs +0 -156
- package/dist/powerlines/src/plugin-utils/paths.cjs +0 -36
- package/dist/powerlines/src/plugin-utils/paths.mjs +0 -35
- package/dist/powerlines/src/types/babel.d.mts +0 -4
- package/dist/powerlines/src/types/build.cjs +0 -23
- package/dist/powerlines/src/types/build.mjs +0 -21
- package/dist/powerlines/src/types/commands.cjs +0 -16
- package/dist/powerlines/src/types/commands.mjs +0 -15
- package/dist/powerlines/src/types/plugin.cjs +0 -33
- package/dist/powerlines/src/types/plugin.mjs +0 -32
- /package/dist/{powerlines → packages/powerlines}/src/internal/helpers/hooks.d.mts +0 -0
- /package/dist/{powerlines → packages/powerlines}/src/types/api.d.mts +0 -0
- /package/dist/{powerlines → packages/powerlines}/src/types/build.d.mts +0 -0
- /package/dist/{powerlines → packages/powerlines}/src/types/commands.d.mts +0 -0
- /package/dist/{powerlines → packages/powerlines}/src/types/hooks.d.mts +0 -0
- /package/dist/{powerlines → packages/powerlines}/src/types/plugin.d.mts +0 -0
- /package/dist/{powerlines → packages/powerlines}/src/types/resolved.d.mts +0 -0
- /package/dist/{powerlines → packages/powerlines}/src/types/unplugin.d.mts +0 -0
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const require_rolldown_runtime = require('../../../../../../_virtual/rolldown_runtime.cjs');
|
|
4
|
+
const require_constants$1 = require('./constants.cjs');
|
|
5
|
+
const require_utils$1 = require('./utils.cjs');
|
|
6
|
+
|
|
7
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.js
|
|
8
|
+
var require_scan = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
|
|
9
|
+
const utils = require_utils$1.default;
|
|
10
|
+
const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants$1.default;
|
|
11
|
+
const isPathSeparator = (code) => {
|
|
12
|
+
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
13
|
+
};
|
|
14
|
+
const depth = (token) => {
|
|
15
|
+
if (token.isPrefix !== true) token.depth = token.isGlobstar ? Infinity : 1;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Quickly scans a glob pattern and returns an object with a handful of
|
|
19
|
+
* useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
|
|
20
|
+
* `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
|
|
21
|
+
* with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
|
|
22
|
+
*
|
|
23
|
+
* ```js
|
|
24
|
+
* const pm = require('picomatch');
|
|
25
|
+
* console.log(pm.scan('foo/bar/*.js'));
|
|
26
|
+
* { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
|
|
27
|
+
* ```
|
|
28
|
+
* @param {String} `str`
|
|
29
|
+
* @param {Object} `options`
|
|
30
|
+
* @return {Object} Returns an object with tokens and regex source string.
|
|
31
|
+
* @api public
|
|
32
|
+
*/
|
|
33
|
+
const scan = (input, options) => {
|
|
34
|
+
const opts = options || {};
|
|
35
|
+
const length = input.length - 1;
|
|
36
|
+
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
37
|
+
const slashes = [];
|
|
38
|
+
const tokens = [];
|
|
39
|
+
const parts = [];
|
|
40
|
+
let str = input;
|
|
41
|
+
let index = -1;
|
|
42
|
+
let start = 0;
|
|
43
|
+
let lastIndex = 0;
|
|
44
|
+
let isBrace = false;
|
|
45
|
+
let isBracket = false;
|
|
46
|
+
let isGlob = false;
|
|
47
|
+
let isExtglob = false;
|
|
48
|
+
let isGlobstar = false;
|
|
49
|
+
let braceEscaped = false;
|
|
50
|
+
let backslashes = false;
|
|
51
|
+
let negated = false;
|
|
52
|
+
let negatedExtglob = false;
|
|
53
|
+
let finished = false;
|
|
54
|
+
let braces = 0;
|
|
55
|
+
let prev;
|
|
56
|
+
let code;
|
|
57
|
+
let token = {
|
|
58
|
+
value: "",
|
|
59
|
+
depth: 0,
|
|
60
|
+
isGlob: false
|
|
61
|
+
};
|
|
62
|
+
const eos = () => index >= length;
|
|
63
|
+
const peek = () => str.charCodeAt(index + 1);
|
|
64
|
+
const advance = () => {
|
|
65
|
+
prev = code;
|
|
66
|
+
return str.charCodeAt(++index);
|
|
67
|
+
};
|
|
68
|
+
while (index < length) {
|
|
69
|
+
code = advance();
|
|
70
|
+
let next;
|
|
71
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
72
|
+
backslashes = token.backslashes = true;
|
|
73
|
+
code = advance();
|
|
74
|
+
if (code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
78
|
+
braces++;
|
|
79
|
+
while (eos() !== true && (code = advance())) {
|
|
80
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
81
|
+
backslashes = token.backslashes = true;
|
|
82
|
+
advance();
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
86
|
+
braces++;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
90
|
+
isBrace = token.isBrace = true;
|
|
91
|
+
isGlob = token.isGlob = true;
|
|
92
|
+
finished = true;
|
|
93
|
+
if (scanToEnd === true) continue;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
97
|
+
isBrace = token.isBrace = true;
|
|
98
|
+
isGlob = token.isGlob = true;
|
|
99
|
+
finished = true;
|
|
100
|
+
if (scanToEnd === true) continue;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
104
|
+
braces--;
|
|
105
|
+
if (braces === 0) {
|
|
106
|
+
braceEscaped = false;
|
|
107
|
+
isBrace = token.isBrace = true;
|
|
108
|
+
finished = true;
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (scanToEnd === true) continue;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
if (code === CHAR_FORWARD_SLASH) {
|
|
117
|
+
slashes.push(index);
|
|
118
|
+
tokens.push(token);
|
|
119
|
+
token = {
|
|
120
|
+
value: "",
|
|
121
|
+
depth: 0,
|
|
122
|
+
isGlob: false
|
|
123
|
+
};
|
|
124
|
+
if (finished === true) continue;
|
|
125
|
+
if (prev === CHAR_DOT && index === start + 1) {
|
|
126
|
+
start += 2;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
lastIndex = index + 1;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (opts.noext !== true) {
|
|
133
|
+
if ((code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK) === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
134
|
+
isGlob = token.isGlob = true;
|
|
135
|
+
isExtglob = token.isExtglob = true;
|
|
136
|
+
finished = true;
|
|
137
|
+
if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
|
|
138
|
+
if (scanToEnd === true) {
|
|
139
|
+
while (eos() !== true && (code = advance())) {
|
|
140
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
141
|
+
backslashes = token.backslashes = true;
|
|
142
|
+
code = advance();
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
146
|
+
isGlob = token.isGlob = true;
|
|
147
|
+
finished = true;
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (code === CHAR_ASTERISK) {
|
|
157
|
+
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
|
158
|
+
isGlob = token.isGlob = true;
|
|
159
|
+
finished = true;
|
|
160
|
+
if (scanToEnd === true) continue;
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
if (code === CHAR_QUESTION_MARK) {
|
|
164
|
+
isGlob = token.isGlob = true;
|
|
165
|
+
finished = true;
|
|
166
|
+
if (scanToEnd === true) continue;
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
170
|
+
while (eos() !== true && (next = advance())) {
|
|
171
|
+
if (next === CHAR_BACKWARD_SLASH) {
|
|
172
|
+
backslashes = token.backslashes = true;
|
|
173
|
+
advance();
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
177
|
+
isBracket = token.isBracket = true;
|
|
178
|
+
isGlob = token.isGlob = true;
|
|
179
|
+
finished = true;
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (scanToEnd === true) continue;
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
187
|
+
negated = token.negated = true;
|
|
188
|
+
start++;
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
192
|
+
isGlob = token.isGlob = true;
|
|
193
|
+
if (scanToEnd === true) {
|
|
194
|
+
while (eos() !== true && (code = advance())) {
|
|
195
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
196
|
+
backslashes = token.backslashes = true;
|
|
197
|
+
code = advance();
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
201
|
+
finished = true;
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
if (isGlob === true) {
|
|
210
|
+
finished = true;
|
|
211
|
+
if (scanToEnd === true) continue;
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
if (opts.noext === true) {
|
|
216
|
+
isExtglob = false;
|
|
217
|
+
isGlob = false;
|
|
218
|
+
}
|
|
219
|
+
let base = str;
|
|
220
|
+
let prefix = "";
|
|
221
|
+
let glob = "";
|
|
222
|
+
if (start > 0) {
|
|
223
|
+
prefix = str.slice(0, start);
|
|
224
|
+
str = str.slice(start);
|
|
225
|
+
lastIndex -= start;
|
|
226
|
+
}
|
|
227
|
+
if (base && isGlob === true && lastIndex > 0) {
|
|
228
|
+
base = str.slice(0, lastIndex);
|
|
229
|
+
glob = str.slice(lastIndex);
|
|
230
|
+
} else if (isGlob === true) {
|
|
231
|
+
base = "";
|
|
232
|
+
glob = str;
|
|
233
|
+
} else base = str;
|
|
234
|
+
if (base && base !== "" && base !== "/" && base !== str) {
|
|
235
|
+
if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
|
|
236
|
+
}
|
|
237
|
+
if (opts.unescape === true) {
|
|
238
|
+
if (glob) glob = utils.removeBackslashes(glob);
|
|
239
|
+
if (base && backslashes === true) base = utils.removeBackslashes(base);
|
|
240
|
+
}
|
|
241
|
+
const state = {
|
|
242
|
+
prefix,
|
|
243
|
+
input,
|
|
244
|
+
start,
|
|
245
|
+
base,
|
|
246
|
+
glob,
|
|
247
|
+
isBrace,
|
|
248
|
+
isBracket,
|
|
249
|
+
isGlob,
|
|
250
|
+
isExtglob,
|
|
251
|
+
isGlobstar,
|
|
252
|
+
negated,
|
|
253
|
+
negatedExtglob
|
|
254
|
+
};
|
|
255
|
+
if (opts.tokens === true) {
|
|
256
|
+
state.maxDepth = 0;
|
|
257
|
+
if (!isPathSeparator(code)) tokens.push(token);
|
|
258
|
+
state.tokens = tokens;
|
|
259
|
+
}
|
|
260
|
+
if (opts.parts === true || opts.tokens === true) {
|
|
261
|
+
let prevIndex;
|
|
262
|
+
for (let idx = 0; idx < slashes.length; idx++) {
|
|
263
|
+
const n = prevIndex ? prevIndex + 1 : start;
|
|
264
|
+
const i = slashes[idx];
|
|
265
|
+
const value = input.slice(n, i);
|
|
266
|
+
if (opts.tokens) {
|
|
267
|
+
if (idx === 0 && start !== 0) {
|
|
268
|
+
tokens[idx].isPrefix = true;
|
|
269
|
+
tokens[idx].value = prefix;
|
|
270
|
+
} else tokens[idx].value = value;
|
|
271
|
+
depth(tokens[idx]);
|
|
272
|
+
state.maxDepth += tokens[idx].depth;
|
|
273
|
+
}
|
|
274
|
+
if (idx !== 0 || value !== "") parts.push(value);
|
|
275
|
+
prevIndex = i;
|
|
276
|
+
}
|
|
277
|
+
if (prevIndex && prevIndex + 1 < input.length) {
|
|
278
|
+
const value = input.slice(prevIndex + 1);
|
|
279
|
+
parts.push(value);
|
|
280
|
+
if (opts.tokens) {
|
|
281
|
+
tokens[tokens.length - 1].value = value;
|
|
282
|
+
depth(tokens[tokens.length - 1]);
|
|
283
|
+
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
state.slashes = slashes;
|
|
287
|
+
state.parts = parts;
|
|
288
|
+
}
|
|
289
|
+
return state;
|
|
290
|
+
};
|
|
291
|
+
module.exports = scan;
|
|
292
|
+
}));
|
|
293
|
+
|
|
294
|
+
//#endregion
|
|
295
|
+
Object.defineProperty(exports, 'default', {
|
|
296
|
+
enumerable: true,
|
|
297
|
+
get: function () {
|
|
298
|
+
return require_scan();
|
|
299
|
+
}
|
|
300
|
+
});
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../_virtual/rolldown_runtime.mjs";
|
|
2
|
+
import { require_constants } from "./constants.mjs";
|
|
3
|
+
import { require_utils } from "./utils.mjs";
|
|
4
|
+
|
|
5
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/scan.js
|
|
6
|
+
var require_scan = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7
|
+
const utils = require_utils();
|
|
8
|
+
const { CHAR_ASTERISK, CHAR_AT, CHAR_BACKWARD_SLASH, CHAR_COMMA, CHAR_DOT, CHAR_EXCLAMATION_MARK, CHAR_FORWARD_SLASH, CHAR_LEFT_CURLY_BRACE, CHAR_LEFT_PARENTHESES, CHAR_LEFT_SQUARE_BRACKET, CHAR_PLUS, CHAR_QUESTION_MARK, CHAR_RIGHT_CURLY_BRACE, CHAR_RIGHT_PARENTHESES, CHAR_RIGHT_SQUARE_BRACKET } = require_constants();
|
|
9
|
+
const isPathSeparator = (code) => {
|
|
10
|
+
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
11
|
+
};
|
|
12
|
+
const depth = (token) => {
|
|
13
|
+
if (token.isPrefix !== true) token.depth = token.isGlobstar ? Infinity : 1;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Quickly scans a glob pattern and returns an object with a handful of
|
|
17
|
+
* useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
|
|
18
|
+
* `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
|
|
19
|
+
* with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
|
|
20
|
+
*
|
|
21
|
+
* ```js
|
|
22
|
+
* const pm = require('picomatch');
|
|
23
|
+
* console.log(pm.scan('foo/bar/*.js'));
|
|
24
|
+
* { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
|
|
25
|
+
* ```
|
|
26
|
+
* @param {String} `str`
|
|
27
|
+
* @param {Object} `options`
|
|
28
|
+
* @return {Object} Returns an object with tokens and regex source string.
|
|
29
|
+
* @api public
|
|
30
|
+
*/
|
|
31
|
+
const scan = (input, options) => {
|
|
32
|
+
const opts = options || {};
|
|
33
|
+
const length = input.length - 1;
|
|
34
|
+
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
35
|
+
const slashes = [];
|
|
36
|
+
const tokens = [];
|
|
37
|
+
const parts = [];
|
|
38
|
+
let str = input;
|
|
39
|
+
let index = -1;
|
|
40
|
+
let start = 0;
|
|
41
|
+
let lastIndex = 0;
|
|
42
|
+
let isBrace = false;
|
|
43
|
+
let isBracket = false;
|
|
44
|
+
let isGlob = false;
|
|
45
|
+
let isExtglob = false;
|
|
46
|
+
let isGlobstar = false;
|
|
47
|
+
let braceEscaped = false;
|
|
48
|
+
let backslashes = false;
|
|
49
|
+
let negated = false;
|
|
50
|
+
let negatedExtglob = false;
|
|
51
|
+
let finished = false;
|
|
52
|
+
let braces = 0;
|
|
53
|
+
let prev;
|
|
54
|
+
let code;
|
|
55
|
+
let token = {
|
|
56
|
+
value: "",
|
|
57
|
+
depth: 0,
|
|
58
|
+
isGlob: false
|
|
59
|
+
};
|
|
60
|
+
const eos = () => index >= length;
|
|
61
|
+
const peek = () => str.charCodeAt(index + 1);
|
|
62
|
+
const advance = () => {
|
|
63
|
+
prev = code;
|
|
64
|
+
return str.charCodeAt(++index);
|
|
65
|
+
};
|
|
66
|
+
while (index < length) {
|
|
67
|
+
code = advance();
|
|
68
|
+
let next;
|
|
69
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
70
|
+
backslashes = token.backslashes = true;
|
|
71
|
+
code = advance();
|
|
72
|
+
if (code === CHAR_LEFT_CURLY_BRACE) braceEscaped = true;
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
76
|
+
braces++;
|
|
77
|
+
while (eos() !== true && (code = advance())) {
|
|
78
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
79
|
+
backslashes = token.backslashes = true;
|
|
80
|
+
advance();
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
84
|
+
braces++;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
88
|
+
isBrace = token.isBrace = true;
|
|
89
|
+
isGlob = token.isGlob = true;
|
|
90
|
+
finished = true;
|
|
91
|
+
if (scanToEnd === true) continue;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
95
|
+
isBrace = token.isBrace = true;
|
|
96
|
+
isGlob = token.isGlob = true;
|
|
97
|
+
finished = true;
|
|
98
|
+
if (scanToEnd === true) continue;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
102
|
+
braces--;
|
|
103
|
+
if (braces === 0) {
|
|
104
|
+
braceEscaped = false;
|
|
105
|
+
isBrace = token.isBrace = true;
|
|
106
|
+
finished = true;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (scanToEnd === true) continue;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
if (code === CHAR_FORWARD_SLASH) {
|
|
115
|
+
slashes.push(index);
|
|
116
|
+
tokens.push(token);
|
|
117
|
+
token = {
|
|
118
|
+
value: "",
|
|
119
|
+
depth: 0,
|
|
120
|
+
isGlob: false
|
|
121
|
+
};
|
|
122
|
+
if (finished === true) continue;
|
|
123
|
+
if (prev === CHAR_DOT && index === start + 1) {
|
|
124
|
+
start += 2;
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
lastIndex = index + 1;
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (opts.noext !== true) {
|
|
131
|
+
if ((code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK) === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
132
|
+
isGlob = token.isGlob = true;
|
|
133
|
+
isExtglob = token.isExtglob = true;
|
|
134
|
+
finished = true;
|
|
135
|
+
if (code === CHAR_EXCLAMATION_MARK && index === start) negatedExtglob = true;
|
|
136
|
+
if (scanToEnd === true) {
|
|
137
|
+
while (eos() !== true && (code = advance())) {
|
|
138
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
139
|
+
backslashes = token.backslashes = true;
|
|
140
|
+
code = advance();
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
144
|
+
isGlob = token.isGlob = true;
|
|
145
|
+
finished = true;
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (code === CHAR_ASTERISK) {
|
|
155
|
+
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
|
156
|
+
isGlob = token.isGlob = true;
|
|
157
|
+
finished = true;
|
|
158
|
+
if (scanToEnd === true) continue;
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
if (code === CHAR_QUESTION_MARK) {
|
|
162
|
+
isGlob = token.isGlob = true;
|
|
163
|
+
finished = true;
|
|
164
|
+
if (scanToEnd === true) continue;
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
168
|
+
while (eos() !== true && (next = advance())) {
|
|
169
|
+
if (next === CHAR_BACKWARD_SLASH) {
|
|
170
|
+
backslashes = token.backslashes = true;
|
|
171
|
+
advance();
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
175
|
+
isBracket = token.isBracket = true;
|
|
176
|
+
isGlob = token.isGlob = true;
|
|
177
|
+
finished = true;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (scanToEnd === true) continue;
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
185
|
+
negated = token.negated = true;
|
|
186
|
+
start++;
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
190
|
+
isGlob = token.isGlob = true;
|
|
191
|
+
if (scanToEnd === true) {
|
|
192
|
+
while (eos() !== true && (code = advance())) {
|
|
193
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
194
|
+
backslashes = token.backslashes = true;
|
|
195
|
+
code = advance();
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
199
|
+
finished = true;
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
if (isGlob === true) {
|
|
208
|
+
finished = true;
|
|
209
|
+
if (scanToEnd === true) continue;
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
if (opts.noext === true) {
|
|
214
|
+
isExtglob = false;
|
|
215
|
+
isGlob = false;
|
|
216
|
+
}
|
|
217
|
+
let base = str;
|
|
218
|
+
let prefix = "";
|
|
219
|
+
let glob = "";
|
|
220
|
+
if (start > 0) {
|
|
221
|
+
prefix = str.slice(0, start);
|
|
222
|
+
str = str.slice(start);
|
|
223
|
+
lastIndex -= start;
|
|
224
|
+
}
|
|
225
|
+
if (base && isGlob === true && lastIndex > 0) {
|
|
226
|
+
base = str.slice(0, lastIndex);
|
|
227
|
+
glob = str.slice(lastIndex);
|
|
228
|
+
} else if (isGlob === true) {
|
|
229
|
+
base = "";
|
|
230
|
+
glob = str;
|
|
231
|
+
} else base = str;
|
|
232
|
+
if (base && base !== "" && base !== "/" && base !== str) {
|
|
233
|
+
if (isPathSeparator(base.charCodeAt(base.length - 1))) base = base.slice(0, -1);
|
|
234
|
+
}
|
|
235
|
+
if (opts.unescape === true) {
|
|
236
|
+
if (glob) glob = utils.removeBackslashes(glob);
|
|
237
|
+
if (base && backslashes === true) base = utils.removeBackslashes(base);
|
|
238
|
+
}
|
|
239
|
+
const state = {
|
|
240
|
+
prefix,
|
|
241
|
+
input,
|
|
242
|
+
start,
|
|
243
|
+
base,
|
|
244
|
+
glob,
|
|
245
|
+
isBrace,
|
|
246
|
+
isBracket,
|
|
247
|
+
isGlob,
|
|
248
|
+
isExtglob,
|
|
249
|
+
isGlobstar,
|
|
250
|
+
negated,
|
|
251
|
+
negatedExtglob
|
|
252
|
+
};
|
|
253
|
+
if (opts.tokens === true) {
|
|
254
|
+
state.maxDepth = 0;
|
|
255
|
+
if (!isPathSeparator(code)) tokens.push(token);
|
|
256
|
+
state.tokens = tokens;
|
|
257
|
+
}
|
|
258
|
+
if (opts.parts === true || opts.tokens === true) {
|
|
259
|
+
let prevIndex;
|
|
260
|
+
for (let idx = 0; idx < slashes.length; idx++) {
|
|
261
|
+
const n = prevIndex ? prevIndex + 1 : start;
|
|
262
|
+
const i = slashes[idx];
|
|
263
|
+
const value = input.slice(n, i);
|
|
264
|
+
if (opts.tokens) {
|
|
265
|
+
if (idx === 0 && start !== 0) {
|
|
266
|
+
tokens[idx].isPrefix = true;
|
|
267
|
+
tokens[idx].value = prefix;
|
|
268
|
+
} else tokens[idx].value = value;
|
|
269
|
+
depth(tokens[idx]);
|
|
270
|
+
state.maxDepth += tokens[idx].depth;
|
|
271
|
+
}
|
|
272
|
+
if (idx !== 0 || value !== "") parts.push(value);
|
|
273
|
+
prevIndex = i;
|
|
274
|
+
}
|
|
275
|
+
if (prevIndex && prevIndex + 1 < input.length) {
|
|
276
|
+
const value = input.slice(prevIndex + 1);
|
|
277
|
+
parts.push(value);
|
|
278
|
+
if (opts.tokens) {
|
|
279
|
+
tokens[tokens.length - 1].value = value;
|
|
280
|
+
depth(tokens[tokens.length - 1]);
|
|
281
|
+
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
state.slashes = slashes;
|
|
285
|
+
state.parts = parts;
|
|
286
|
+
}
|
|
287
|
+
return state;
|
|
288
|
+
};
|
|
289
|
+
module.exports = scan;
|
|
290
|
+
}));
|
|
291
|
+
|
|
292
|
+
//#endregion
|
|
293
|
+
export default require_scan();
|
|
294
|
+
|
|
295
|
+
export { require_scan };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const require_rolldown_runtime = require('../../../../../../_virtual/rolldown_runtime.cjs');
|
|
4
|
+
const require_constants$1 = require('./constants.cjs');
|
|
5
|
+
|
|
6
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js
|
|
7
|
+
var require_utils = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
|
|
8
|
+
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants$1.default;
|
|
9
|
+
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
10
|
+
exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
|
|
11
|
+
exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
|
|
12
|
+
exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
|
|
13
|
+
exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
|
|
14
|
+
exports.isWindows = () => {
|
|
15
|
+
if (typeof navigator !== "undefined" && navigator.platform) {
|
|
16
|
+
const platform = navigator.platform.toLowerCase();
|
|
17
|
+
return platform === "win32" || platform === "windows";
|
|
18
|
+
}
|
|
19
|
+
if (typeof process !== "undefined" && process.platform) return process.platform === "win32";
|
|
20
|
+
return false;
|
|
21
|
+
};
|
|
22
|
+
exports.removeBackslashes = (str) => {
|
|
23
|
+
return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
|
|
24
|
+
return match === "\\" ? "" : match;
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
exports.escapeLast = (input, char, lastIdx) => {
|
|
28
|
+
const idx = input.lastIndexOf(char, lastIdx);
|
|
29
|
+
if (idx === -1) return input;
|
|
30
|
+
if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
|
|
31
|
+
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
32
|
+
};
|
|
33
|
+
exports.removePrefix = (input, state = {}) => {
|
|
34
|
+
let output = input;
|
|
35
|
+
if (output.startsWith("./")) {
|
|
36
|
+
output = output.slice(2);
|
|
37
|
+
state.prefix = "./";
|
|
38
|
+
}
|
|
39
|
+
return output;
|
|
40
|
+
};
|
|
41
|
+
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
42
|
+
let output = `${options.contains ? "" : "^"}(?:${input})${options.contains ? "" : "$"}`;
|
|
43
|
+
if (state.negated === true) output = `(?:^(?!${output}).*$)`;
|
|
44
|
+
return output;
|
|
45
|
+
};
|
|
46
|
+
exports.basename = (path, { windows } = {}) => {
|
|
47
|
+
const segs = path.split(windows ? /[\\/]/ : "/");
|
|
48
|
+
const last = segs[segs.length - 1];
|
|
49
|
+
if (last === "") return segs[segs.length - 2];
|
|
50
|
+
return last;
|
|
51
|
+
};
|
|
52
|
+
}));
|
|
53
|
+
|
|
54
|
+
//#endregion
|
|
55
|
+
Object.defineProperty(exports, 'default', {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () {
|
|
58
|
+
return require_utils();
|
|
59
|
+
}
|
|
60
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../_virtual/rolldown_runtime.mjs";
|
|
2
|
+
import { require_constants } from "./constants.mjs";
|
|
3
|
+
|
|
4
|
+
//#region ../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/utils.js
|
|
5
|
+
var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
6
|
+
const { REGEX_BACKSLASH, REGEX_REMOVE_BACKSLASH, REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_GLOBAL } = require_constants();
|
|
7
|
+
exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
8
|
+
exports.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
|
|
9
|
+
exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
|
|
10
|
+
exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
|
|
11
|
+
exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
|
|
12
|
+
exports.isWindows = () => {
|
|
13
|
+
if (typeof navigator !== "undefined" && navigator.platform) {
|
|
14
|
+
const platform = navigator.platform.toLowerCase();
|
|
15
|
+
return platform === "win32" || platform === "windows";
|
|
16
|
+
}
|
|
17
|
+
if (typeof process !== "undefined" && process.platform) return process.platform === "win32";
|
|
18
|
+
return false;
|
|
19
|
+
};
|
|
20
|
+
exports.removeBackslashes = (str) => {
|
|
21
|
+
return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
|
|
22
|
+
return match === "\\" ? "" : match;
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
exports.escapeLast = (input, char, lastIdx) => {
|
|
26
|
+
const idx = input.lastIndexOf(char, lastIdx);
|
|
27
|
+
if (idx === -1) return input;
|
|
28
|
+
if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
|
|
29
|
+
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
30
|
+
};
|
|
31
|
+
exports.removePrefix = (input, state = {}) => {
|
|
32
|
+
let output = input;
|
|
33
|
+
if (output.startsWith("./")) {
|
|
34
|
+
output = output.slice(2);
|
|
35
|
+
state.prefix = "./";
|
|
36
|
+
}
|
|
37
|
+
return output;
|
|
38
|
+
};
|
|
39
|
+
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
40
|
+
let output = `${options.contains ? "" : "^"}(?:${input})${options.contains ? "" : "$"}`;
|
|
41
|
+
if (state.negated === true) output = `(?:^(?!${output}).*$)`;
|
|
42
|
+
return output;
|
|
43
|
+
};
|
|
44
|
+
exports.basename = (path, { windows } = {}) => {
|
|
45
|
+
const segs = path.split(windows ? /[\\/]/ : "/");
|
|
46
|
+
const last = segs[segs.length - 1];
|
|
47
|
+
if (last === "") return segs[segs.length - 2];
|
|
48
|
+
return last;
|
|
49
|
+
};
|
|
50
|
+
}));
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
export default require_utils();
|
|
54
|
+
|
|
55
|
+
export { require_utils };
|