vike 0.4.259 → 0.4.260-commit-2e7fb2a
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/AGENTS.md +3 -0
- package/README.md +2 -0
- package/dist/client/runtime-client-routing/renderPageClient.js +1 -1
- package/dist/client/shared/getJsonSerializedInHtml.js +1 -10
- package/dist/node/api/build.js +6 -6
- package/dist/node/api/dev.d.ts +2 -10
- package/dist/node/api/dev.js +5 -52
- package/dist/node/api/prepareViteApiCall.d.ts +1 -1
- package/dist/node/api/prepareViteApiCall.js +2 -2
- package/dist/node/api/prerender.js +2 -2
- package/dist/node/api/preview.d.ts +2 -2
- package/dist/node/api/preview.js +15 -16
- package/dist/node/api/{resolveViteConfigFromUser.d.ts → resolveViteConfigUser.d.ts} +5 -5
- package/dist/node/api/{resolveViteConfigFromUser.js → resolveViteConfigUser.js} +100 -69
- package/dist/node/api/startupLog.d.ts +4 -0
- package/dist/node/api/{getStartupLogFirstLine.js → startupLog.js} +14 -1
- package/dist/node/api/types.d.ts +9 -0
- package/dist/node/cli/entry.js +1 -5
- package/dist/node/cli/parseCli.js +26 -12
- package/dist/node/createDevMiddleware.js +2 -2
- package/dist/node/prerender/runPrerender.d.ts +8 -2
- package/dist/node/prerender/runPrerender.js +3 -1
- package/dist/node/prerender/runPrerenderEntry.js +2 -2
- package/dist/node/vite/index.js +2 -2
- package/dist/node/vite/plugins/build/handleAssetsManifest.d.ts +2 -6
- package/dist/node/vite/plugins/build/handleAssetsManifest.js +16 -9
- package/dist/node/vite/plugins/build/pluginBuildApp.js +10 -5
- package/dist/node/vite/plugins/build/pluginBuildConfig.d.ts +6 -1
- package/dist/node/vite/plugins/build/pluginBuildConfig.js +13 -11
- package/dist/node/vite/plugins/build/pluginDistFileNames.js +1 -6
- package/dist/node/vite/plugins/build/pluginModuleBanner.js +2 -4
- package/dist/node/vite/plugins/pluginCommon.d.ts +1 -1
- package/dist/node/vite/plugins/pluginCommon.js +15 -7
- package/dist/node/vite/plugins/pluginDev/autoAddVikeSkill.d.ts +3 -0
- package/dist/node/vite/plugins/pluginDev/autoAddVikeSkill.js +174 -0
- package/dist/node/vite/plugins/pluginDev/optimizeDeps.js +67 -31
- package/dist/node/vite/plugins/pluginDev.js +17 -0
- package/dist/node/vite/plugins/pluginStripPointerImportAttribute.js +31 -10
- package/dist/node/vite/plugins/pluginVirtualFiles/generateVirtualFilePageEntry.js +5 -7
- package/dist/node/vite/plugins/pluginVirtualFiles/getConfigValueSourcesRelevant.d.ts +2 -2
- package/dist/node/vite/plugins/pluginVirtualFiles.js +1 -1
- package/dist/node/vite/shared/addSsrMiddleware.js +1 -1
- package/dist/node/vite/shared/getMagicString.d.ts +1 -1
- package/dist/node/vite/shared/getMagicString.js +3 -0
- package/dist/node/vite/shared/isVite8OrAbove.d.ts +4 -0
- package/dist/node/vite/shared/isVite8OrAbove.js +9 -0
- package/dist/node/vite/shared/isViteCli.d.ts +9 -4
- package/dist/node/vite/shared/isViteCli.js +24 -4
- package/dist/node/vite/shared/loggerDev.js +6 -5
- package/dist/node/vite/shared/loggerVite.js +3 -2
- package/dist/node/vite/shared/resolveVikeConfigInternal/assertExtensions.d.ts +3 -1
- package/dist/node/vite/shared/resolveVikeConfigInternal/assertExtensions.js +6 -5
- package/dist/node/vite/shared/resolveVikeConfigInternal/{crawlPlusFilePaths.d.ts → crawlPlusFiles.d.ts} +2 -2
- package/dist/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles.js +71 -0
- package/dist/node/vite/shared/resolveVikeConfigInternal/{getPlusFilesByLocationId.d.ts → getPlusFiles.d.ts} +5 -3
- package/dist/node/vite/shared/resolveVikeConfigInternal/{getPlusFilesByLocationId.js → getPlusFiles.js} +18 -17
- package/dist/node/vite/shared/resolveVikeConfigInternal/loadFileAtConfigTime.d.ts +1 -1
- package/dist/node/vite/shared/resolveVikeConfigInternal/metaBuiltIn.d.ts +15 -15
- package/dist/node/vite/shared/resolveVikeConfigInternal/metaBuiltIn.js +19 -0
- package/dist/node/vite/shared/resolveVikeConfigInternal.d.ts +19 -4
- package/dist/node/vite/shared/resolveVikeConfigInternal.js +217 -76
- package/dist/server/runtime/globalContext.js +4 -1
- package/dist/server/runtime/renderPageServer/createPageContextServer.d.ts +12 -3
- package/dist/server/runtime/renderPageServer/html/injectAssets/getHtmlTags.js +2 -3
- package/dist/server/runtime/renderPageServer/html/injectAssets/injectHtmlTags.js +3 -1
- package/dist/server/runtime/renderPageServer/html/serializeContext.js +5 -10
- package/dist/server/runtime/renderPageServer/loadPageConfigsLazyServerSide.d.ts +8 -2
- package/dist/server/runtime/renderPageServer/renderPageServerAfterRoute.d.ts +32 -8
- package/dist/server/runtime/renderPageServer/renderPageServerAfterRoute.js +1 -1
- package/dist/server/runtime/renderPageServer.d.ts +8 -2
- package/dist/server/runtime/renderPageServer.js +6 -4
- package/dist/shared-server-client/page-configs/serialize/serializeConfigValues.d.ts +3 -3
- package/dist/shared-server-client/page-configs/serialize/serializeConfigValues.js +8 -1
- package/dist/types/Config.d.ts +54 -6
- package/dist/types/PageConfig.d.ts +12 -10
- package/dist/types/PageContext.d.ts +8 -3
- package/dist/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/utils/PROJECT_VERSION.js +1 -1
- package/dist/utils/assert.d.ts +2 -0
- package/dist/utils/assert.js +8 -8
- package/dist/utils/assertViteVersion.js +1 -1
- package/dist/utils/crawlFiles/ignorePatternsBuiltIn.d.ts +1 -0
- package/dist/{node/vite/shared/resolveVikeConfigInternal/crawlPlusFilePaths → utils/crawlFiles}/ignorePatternsBuiltIn.js +1 -1
- package/dist/utils/crawlFiles.d.ts +21 -0
- package/dist/utils/crawlFiles.js +195 -0
- package/dist/utils/debug.d.ts +1 -1
- package/dist/utils/debug.js +1 -0
- package/dist/{node/vite/shared → utils}/getEnvVarObject.d.ts +0 -1
- package/dist/{node/vite/shared → utils}/getEnvVarObject.js +4 -3
- package/dist/utils/getViteRPC.js +1 -1
- package/dist/utils/objectMap.d.ts +2 -0
- package/dist/utils/objectMap.js +4 -0
- package/dist/utils/parseNpmPackage.js +4 -1
- package/dist/utils/pick.d.ts +1 -1
- package/dist/utils/setTimeoutUnref.d.ts +2 -0
- package/dist/utils/setTimeoutUnref.js +11 -0
- package/package.json +19 -21
- package/dist/node/api/getStartupLogFirstLine.d.ts +0 -7
- package/dist/node/vite/shared/resolveVikeConfigInternal/crawlPlusFilePaths/ignorePatternsBuiltIn.d.ts +0 -2
- package/dist/node/vite/shared/resolveVikeConfigInternal/crawlPlusFilePaths.js +0 -258
- package/dist/server/__internal/vite.d.ts +0 -2
- package/dist/server/__internal/vite.js +0 -2
- package/dist/server/runtime/renderPageServer/html/injectAssets/sanitizeJson.d.ts +0 -4
- package/dist/server/runtime/renderPageServer/html/injectAssets/sanitizeJson.js +0 -7
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
export { crawlPlusFilePaths };
|
|
2
|
-
export { isPlusFile };
|
|
3
|
-
export { getPlusFileValueConfigName };
|
|
4
|
-
import { assert, assertUsage, assertWarning } from '../../../../utils/assert.js';
|
|
5
|
-
import { assertIsNotProductionRuntime } from '../../../../utils/assertSetup.js';
|
|
6
|
-
import { isVersionMatch } from '../../../../utils/assertVersion.js';
|
|
7
|
-
import { createDebug } from '../../../../utils/debug.js';
|
|
8
|
-
import { deepEqual } from '../../../../utils/deepEqual.js';
|
|
9
|
-
import { getGlobalObject } from '../../../../utils/getGlobalObject.js';
|
|
10
|
-
import { hasProp } from '../../../../utils/hasProp.js';
|
|
11
|
-
import { assertFilePathAbsoluteFilesystem } from '../../../../utils/isFilePathAbsoluteFilesystem.js';
|
|
12
|
-
import { isNotNullish } from '../../../../utils/isNullish.js';
|
|
13
|
-
import { scriptFileExtensionPattern, isScriptFile, scriptFileExtensionList } from '../../../../utils/isScriptFile.js';
|
|
14
|
-
import { assertPosixPath } from '../../../../utils/path.js';
|
|
15
|
-
import path from 'node:path';
|
|
16
|
-
import { glob } from 'tinyglobby';
|
|
17
|
-
import { exec } from 'node:child_process';
|
|
18
|
-
import { promisify } from 'node:util';
|
|
19
|
-
import { isTemporaryBuildFile } from './transpileAndExecuteFile.js';
|
|
20
|
-
import { getEnvVarObject } from '../getEnvVarObject.js';
|
|
21
|
-
import pc from '@brillout/picocolors';
|
|
22
|
-
import picomatch from 'picomatch';
|
|
23
|
-
import { ignorePatternsBuiltIn } from './crawlPlusFilePaths/ignorePatternsBuiltIn.js';
|
|
24
|
-
import '../../assertEnvVite.js';
|
|
25
|
-
const execA = promisify(exec);
|
|
26
|
-
const debug = createDebug('vike:crawl');
|
|
27
|
-
assertIsNotProductionRuntime();
|
|
28
|
-
const globalObject = getGlobalObject('getVikeConfig/crawlPlusFilePaths.ts', {
|
|
29
|
-
gitIsNotUsable: false,
|
|
30
|
-
});
|
|
31
|
-
async function crawlPlusFilePaths(userRootDir) {
|
|
32
|
-
assertPosixPath(userRootDir);
|
|
33
|
-
assertFilePathAbsoluteFilesystem(userRootDir);
|
|
34
|
-
const userSettings = getUserSettings();
|
|
35
|
-
const { ignorePatterns, ignoreMatchers } = getIgnore(userSettings);
|
|
36
|
-
// Crawl
|
|
37
|
-
const filesGit = userSettings.git !== false && (await gitLsFiles(userRootDir, ignorePatterns, ignoreMatchers));
|
|
38
|
-
const filesGitNothingFound = !filesGit || filesGit.length === 0;
|
|
39
|
-
const filesGlob = (filesGitNothingFound || debug.isActivated) && (await tinyglobby(userRootDir, ignorePatterns));
|
|
40
|
-
let files = !filesGitNothingFound
|
|
41
|
-
? filesGit
|
|
42
|
-
: // Fallback to tinyglobby for users that dynamically generate plus files. (Assuming that no plus file is found because of the user's .gitignore list.)
|
|
43
|
-
filesGlob;
|
|
44
|
-
assert(files);
|
|
45
|
-
if (debug.isActivated && filesGit && filesGlob) {
|
|
46
|
-
assertWarning(deepEqual(filesGlob.slice().sort(), filesGit.slice().sort()), "Git and glob results aren't matching.", { onlyOnce: false });
|
|
47
|
-
}
|
|
48
|
-
// Filter build files
|
|
49
|
-
files = files.filter((filePath) => !isTemporaryBuildFile(filePath));
|
|
50
|
-
// Normalize
|
|
51
|
-
const plusFiles = files.map((filePath) => {
|
|
52
|
-
// Both `$ git-ls files` and tinyglobby return posix paths
|
|
53
|
-
assertPosixPath(filePath);
|
|
54
|
-
assert(!filePath.startsWith(userRootDir));
|
|
55
|
-
const filePathAbsoluteUserRootDir = path.posix.join('/', filePath);
|
|
56
|
-
assert(isPlusFile(filePathAbsoluteUserRootDir));
|
|
57
|
-
return { filePathAbsoluteUserRootDir };
|
|
58
|
-
});
|
|
59
|
-
return plusFiles;
|
|
60
|
-
}
|
|
61
|
-
// Same as tinyglobby() but using `$ git ls-files`
|
|
62
|
-
async function gitLsFiles(userRootDir, ignorePatterns, ignoreMatchers) {
|
|
63
|
-
if (globalObject.gitIsNotUsable)
|
|
64
|
-
return null;
|
|
65
|
-
// Preserve UTF-8 file paths.
|
|
66
|
-
// https://github.com/vikejs/vike/issues/1658
|
|
67
|
-
// https://stackoverflow.com/questions/22827239/how-to-make-git-properly-display-utf-8-encoded-pathnames-in-the-console-window/22828826#22828826
|
|
68
|
-
// https://stackoverflow.com/questions/15884180/how-do-i-override-git-configuration-options-by-command-line-parameters/15884261#15884261
|
|
69
|
-
const preserveUTF8 = '-c core.quotepath=off';
|
|
70
|
-
const cmd = [
|
|
71
|
-
'git',
|
|
72
|
-
preserveUTF8,
|
|
73
|
-
'ls-files',
|
|
74
|
-
// Performance gain seems negligible: https://github.com/vikejs/vike/pull/1688#issuecomment-2166206648
|
|
75
|
-
...scriptFileExtensionList.map((ext) => `"**/+*.${ext}" "+*.${ext}"`),
|
|
76
|
-
// Performance gain is non-negligible.
|
|
77
|
-
// - https://github.com/vikejs/vike/pull/1688#issuecomment-2166206648
|
|
78
|
-
// - When node_modules/ is untracked the performance gain could be significant?
|
|
79
|
-
...ignorePatterns.map((pattern) => `--exclude="${pattern}"`),
|
|
80
|
-
// --others --exclude-standard => list untracked files (--others) while using .gitignore (--exclude-standard)
|
|
81
|
-
// --cached => list tracked files
|
|
82
|
-
'--others --exclude-standard --cached',
|
|
83
|
-
].join(' ');
|
|
84
|
-
let filesAll;
|
|
85
|
-
let filesDeleted;
|
|
86
|
-
try {
|
|
87
|
-
;
|
|
88
|
-
[filesAll, filesDeleted] = await Promise.all([
|
|
89
|
-
// Main command
|
|
90
|
-
runCmd1(cmd, userRootDir),
|
|
91
|
-
// Get tracked but deleted files
|
|
92
|
-
runCmd1('git ls-files --deleted', userRootDir),
|
|
93
|
-
]);
|
|
94
|
-
}
|
|
95
|
-
catch (err) {
|
|
96
|
-
if (await isGitNotUsable(userRootDir)) {
|
|
97
|
-
globalObject.gitIsNotUsable = true;
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
throw err;
|
|
101
|
-
}
|
|
102
|
-
if (debug.isActivated) {
|
|
103
|
-
debug('[git] userRootDir:', userRootDir);
|
|
104
|
-
debug('[git] cmd:', cmd);
|
|
105
|
-
debug('[git] result:', filesAll);
|
|
106
|
-
debug('[git] filesDeleted:', filesDeleted);
|
|
107
|
-
}
|
|
108
|
-
const files = [];
|
|
109
|
-
for (const filePath of filesAll) {
|
|
110
|
-
// + file?
|
|
111
|
-
if (!path.posix.basename(filePath).startsWith('+'))
|
|
112
|
-
continue;
|
|
113
|
-
// We have to repeat the same exclusion logic here because the option --exclude of `$ git ls-files` only applies to untracked files. (We use --exclude only to speed up the `$ git ls-files` command.)
|
|
114
|
-
if (ignoreMatchers.some((m) => m(filePath)))
|
|
115
|
-
continue;
|
|
116
|
-
// JavaScript file?
|
|
117
|
-
if (!isScriptFile(filePath))
|
|
118
|
-
continue;
|
|
119
|
-
// Deleted?
|
|
120
|
-
if (filesDeleted.includes(filePath))
|
|
121
|
-
continue;
|
|
122
|
-
files.push(filePath);
|
|
123
|
-
}
|
|
124
|
-
return files;
|
|
125
|
-
}
|
|
126
|
-
// Same as gitLsFiles() but using tinyglobby
|
|
127
|
-
async function tinyglobby(userRootDir, ignorePatterns) {
|
|
128
|
-
const pattern = `**/+*.${scriptFileExtensionPattern}`;
|
|
129
|
-
const options = {
|
|
130
|
-
ignore: ignorePatterns,
|
|
131
|
-
cwd: userRootDir,
|
|
132
|
-
dot: false,
|
|
133
|
-
};
|
|
134
|
-
const files = await glob(pattern, options);
|
|
135
|
-
// Make build deterministic, in order to get a stable generated hash for dist/client/assets/entries/entry-client-routing.${hash}.js
|
|
136
|
-
// https://github.com/vikejs/vike/pull/1750
|
|
137
|
-
files.sort();
|
|
138
|
-
if (debug.isActivated) {
|
|
139
|
-
debug('[glob] pattern:', pattern);
|
|
140
|
-
debug('[glob] options:', options);
|
|
141
|
-
debug('[glob] result:', files);
|
|
142
|
-
}
|
|
143
|
-
return files;
|
|
144
|
-
}
|
|
145
|
-
// Whether Git is installed and whether we can use it
|
|
146
|
-
async function isGitNotUsable(userRootDir) {
|
|
147
|
-
// Check Git version
|
|
148
|
-
{
|
|
149
|
-
const res = await runCmd2('git --version', userRootDir);
|
|
150
|
-
if ('err' in res)
|
|
151
|
-
return true;
|
|
152
|
-
let { stdout, stderr } = res;
|
|
153
|
-
assert(stderr === '');
|
|
154
|
-
const prefix = 'git version ';
|
|
155
|
-
assert(stdout.startsWith(prefix));
|
|
156
|
-
const gitVersion = stdout.slice(prefix.length);
|
|
157
|
-
// - Works with Git 2.43.1 but also (most certainly) with earlier versions.
|
|
158
|
-
// - We didn't bother test which is the earliest version that works.
|
|
159
|
-
// - Git 2.32.0 doesn't seem to work: https://github.com/vikejs/vike/discussions/1549
|
|
160
|
-
// - Maybe it's because of StackBlitz: looking at the release notes, Git 2.32.0 should be working.
|
|
161
|
-
if (!isVersionMatch(gitVersion, ['2.43.1']))
|
|
162
|
-
return true;
|
|
163
|
-
}
|
|
164
|
-
// Is userRootDir inside a Git repository?
|
|
165
|
-
{
|
|
166
|
-
const res = await runCmd2('git rev-parse --is-inside-work-tree', userRootDir);
|
|
167
|
-
if ('err' in res)
|
|
168
|
-
return true;
|
|
169
|
-
let { stdout, stderr } = res;
|
|
170
|
-
assert(stderr === '');
|
|
171
|
-
assert(stdout === 'true');
|
|
172
|
-
return false;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
async function runCmd1(cmd, cwd) {
|
|
176
|
-
const { stdout } = await execA(cmd, {
|
|
177
|
-
cwd,
|
|
178
|
-
// https://github.com/vikejs/vike/issues/1982
|
|
179
|
-
maxBuffer: Infinity,
|
|
180
|
-
});
|
|
181
|
-
/* Not always true: https://github.com/vikejs/vike/issues/1440#issuecomment-1892831303
|
|
182
|
-
assert(res.stderr === '')
|
|
183
|
-
*/
|
|
184
|
-
return stdout.toString().split('\n').filter(Boolean);
|
|
185
|
-
}
|
|
186
|
-
async function runCmd2(cmd, cwd) {
|
|
187
|
-
let res;
|
|
188
|
-
try {
|
|
189
|
-
res = await execA(cmd, { cwd });
|
|
190
|
-
}
|
|
191
|
-
catch (err) {
|
|
192
|
-
return { err };
|
|
193
|
-
}
|
|
194
|
-
let { stdout, stderr } = res;
|
|
195
|
-
stdout = stdout.toString().trim();
|
|
196
|
-
stderr = stderr.toString().trim();
|
|
197
|
-
return { stdout, stderr };
|
|
198
|
-
}
|
|
199
|
-
function getUserSettings() {
|
|
200
|
-
const userSettings = getEnvVarObject('VIKE_CRAWL') ?? {};
|
|
201
|
-
const wrongUsage = (settingName, settingType) => `Setting ${pc.cyan(settingName)} in VIKE_CRAWL should be a ${pc.cyan(settingType)}`;
|
|
202
|
-
assertUsage(hasProp(userSettings, 'git', 'boolean') || hasProp(userSettings, 'git', 'undefined'), wrongUsage('git', 'boolean'));
|
|
203
|
-
assertUsage(hasProp(userSettings, 'ignore', 'string[]') ||
|
|
204
|
-
hasProp(userSettings, 'ignore', 'string') ||
|
|
205
|
-
hasProp(userSettings, 'ignore', 'undefined'), wrongUsage('git', 'string or an array of strings'));
|
|
206
|
-
assertUsage(hasProp(userSettings, 'ignoreBuiltIn', 'boolean') || hasProp(userSettings, 'ignoreBuiltIn', 'undefined'), wrongUsage('ignoreBuiltIn', 'boolean'));
|
|
207
|
-
const settingNames = ['git', 'ignore', 'ignoreBuiltIn'];
|
|
208
|
-
Object.keys(userSettings).forEach((name) => {
|
|
209
|
-
assertUsage(settingNames.includes(name), `Unknown setting ${pc.bold(pc.red(name))} in VIKE_CRAWL`);
|
|
210
|
-
});
|
|
211
|
-
return userSettings;
|
|
212
|
-
}
|
|
213
|
-
function isPlusFile(filePath) {
|
|
214
|
-
assertPosixPath(filePath);
|
|
215
|
-
if (isTemporaryBuildFile(filePath))
|
|
216
|
-
return false;
|
|
217
|
-
const fileName = filePath.split('/').pop();
|
|
218
|
-
return fileName.startsWith('+');
|
|
219
|
-
}
|
|
220
|
-
function getPlusFileValueConfigName(filePath) {
|
|
221
|
-
if (!isPlusFile(filePath))
|
|
222
|
-
return null;
|
|
223
|
-
const fileName = path.posix.basename(filePath);
|
|
224
|
-
// assertNoUnexpectedPlusSign(filePath, fileName)
|
|
225
|
-
const basename = fileName.split('.')[0];
|
|
226
|
-
assert(basename.startsWith('+'));
|
|
227
|
-
const configName = basename.slice(1);
|
|
228
|
-
assertUsage(configName !== '', `${filePath} Invalid filename ${fileName}`);
|
|
229
|
-
return configName;
|
|
230
|
-
}
|
|
231
|
-
/* https://github.com/vikejs/vike/issues/1407
|
|
232
|
-
function assertNoUnexpectedPlusSign(filePath: string, fileName: string) {
|
|
233
|
-
const dirs = path.posix.dirname(filePath).split('/')
|
|
234
|
-
dirs.forEach((dir, i) => {
|
|
235
|
-
const dirPath = dirs.slice(0, i + 1).join('/')
|
|
236
|
-
assertUsage(
|
|
237
|
-
!dir.includes('+'),
|
|
238
|
-
`Character '+' is a reserved character: remove '+' from the directory name ${dirPath}/`
|
|
239
|
-
)
|
|
240
|
-
})
|
|
241
|
-
assertUsage(
|
|
242
|
-
!fileName.slice(1).includes('+'),
|
|
243
|
-
`Character '+' is only allowed at the beginning of filenames: make sure ${filePath} doesn't contain any '+' in its filename other than its first letter`
|
|
244
|
-
)
|
|
245
|
-
}
|
|
246
|
-
*/
|
|
247
|
-
function getIgnore(userSettings) {
|
|
248
|
-
const ignorePatternsSetByUser = [userSettings.ignore].flat().filter(isNotNullish);
|
|
249
|
-
const { ignoreBuiltIn } = userSettings;
|
|
250
|
-
const ignorePatterns = [...(ignoreBuiltIn === false ? [] : ignorePatternsBuiltIn), ...ignorePatternsSetByUser];
|
|
251
|
-
const ignoreMatchers = ignorePatterns.map((p) => picomatch(p, {
|
|
252
|
-
// We must pass the same settings than tinyglobby
|
|
253
|
-
// https://github.com/SuperchupuDev/tinyglobby/blob/fcfb08a36c3b4d48d5488c21000c95a956d9797c/src/index.ts#L191-L194
|
|
254
|
-
dot: false,
|
|
255
|
-
nocase: false,
|
|
256
|
-
}));
|
|
257
|
-
return { ignorePatterns, ignoreMatchers };
|
|
258
|
-
}
|