@graphql-codegen/cli 6.0.2-alpha-20251107100146-ab5264c4ff8fd142a45caf57bfe2e845bf83b2d1 → 6.1.0-alpha-20251107131717-adc4d901f6e53e023001b84e0cef353e6dad8629
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/cjs/codegen.js +9 -2
- package/cjs/utils/patterns.js +15 -9
- package/cjs/utils/watcher.js +13 -9
- package/esm/codegen.js +9 -2
- package/esm/utils/patterns.js +15 -9
- package/esm/utils/watcher.js +13 -9
- package/package.json +3 -3
- package/typings/codegen.d.cts +3 -1
- package/typings/codegen.d.ts +3 -1
- package/typings/utils/patterns.d.cts +8 -9
- package/typings/utils/patterns.d.ts +8 -9
package/cjs/codegen.js
CHANGED
|
@@ -51,7 +51,7 @@ function createCache() {
|
|
|
51
51
|
return value;
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
async function executeCodegen(input) {
|
|
54
|
+
async function executeCodegen(input, options = { onlyGeneratesKeys: {} }) {
|
|
55
55
|
const context = (0, config_js_1.ensureContext)(input);
|
|
56
56
|
const config = context.getConfig();
|
|
57
57
|
const pluginContext = context.getPluginContext();
|
|
@@ -150,7 +150,14 @@ async function executeCodegen(input) {
|
|
|
150
150
|
{
|
|
151
151
|
title: 'Generate outputs',
|
|
152
152
|
task: (ctx, task) => {
|
|
153
|
-
const
|
|
153
|
+
const originalGeneratesKeys = Object.keys(generates);
|
|
154
|
+
const foundGeneratesKeys = originalGeneratesKeys.filter(generatesKey => options.onlyGeneratesKeys[generatesKey]);
|
|
155
|
+
const effectiveGeneratesKeys = foundGeneratesKeys.length === 0 ? originalGeneratesKeys : foundGeneratesKeys;
|
|
156
|
+
const hasFilteredDownGeneratesKeys = originalGeneratesKeys.length > effectiveGeneratesKeys.length;
|
|
157
|
+
if (hasFilteredDownGeneratesKeys) {
|
|
158
|
+
(0, debugging_js_1.debugLog)(`[CLI] Generating partial config:\n${effectiveGeneratesKeys.map(key => `- ${key}`).join('\n')}`);
|
|
159
|
+
}
|
|
160
|
+
const generateTasks = effectiveGeneratesKeys.map(filename => {
|
|
154
161
|
const outputConfig = generates[filename];
|
|
155
162
|
const hasPreset = !!outputConfig.preset;
|
|
156
163
|
const title = `Generate to ${filename}`;
|
package/cjs/utils/patterns.js
CHANGED
|
@@ -39,9 +39,12 @@ exports.allAffirmativePatternsFromPatternSets = allAffirmativePatternsFromPatter
|
|
|
39
39
|
* a match even if it would be negated by some pattern in documents or schemas
|
|
40
40
|
* * The trigger returns true if any output target's local patterns result in
|
|
41
41
|
* a match, after considering the precedence of any global and local negations
|
|
42
|
+
*
|
|
43
|
+
* The result is a function that when given an absolute path,
|
|
44
|
+
* it will tell which generates blocks' keys are affected so we can re-run for those keys
|
|
42
45
|
*/
|
|
43
46
|
const makeShouldRebuild = ({ globalPatternSet, localPatternSets, }) => {
|
|
44
|
-
const localMatchers = localPatternSets.map(localPatternSet => {
|
|
47
|
+
const localMatchers = Object.entries(localPatternSets).map(([generatesPath, localPatternSet]) => {
|
|
45
48
|
return (path) => {
|
|
46
49
|
// Is path negated by any negating watch pattern?
|
|
47
50
|
if (matchesAnyNegatedPattern(path, [...globalPatternSet.watch.negated, ...localPatternSet.watch.negated])) {
|
|
@@ -54,7 +57,7 @@ const makeShouldRebuild = ({ globalPatternSet, localPatternSets, }) => {
|
|
|
54
57
|
...localPatternSet.watch.affirmative,
|
|
55
58
|
])) {
|
|
56
59
|
// Immediately return true: Watch pattern takes priority, even if documents or schema would negate it
|
|
57
|
-
return
|
|
60
|
+
return generatesPath;
|
|
58
61
|
}
|
|
59
62
|
// Does path match documents patterns (without being negated)?
|
|
60
63
|
if (matchesAnyAffirmativePattern(path, [
|
|
@@ -62,7 +65,7 @@ const makeShouldRebuild = ({ globalPatternSet, localPatternSets, }) => {
|
|
|
62
65
|
...localPatternSet.documents.affirmative,
|
|
63
66
|
]) &&
|
|
64
67
|
!matchesAnyNegatedPattern(path, [...globalPatternSet.documents.negated, ...localPatternSet.documents.negated])) {
|
|
65
|
-
return
|
|
68
|
+
return generatesPath;
|
|
66
69
|
}
|
|
67
70
|
// Does path match schemas patterns (without being negated)?
|
|
68
71
|
if (matchesAnyAffirmativePattern(path, [
|
|
@@ -70,22 +73,25 @@ const makeShouldRebuild = ({ globalPatternSet, localPatternSets, }) => {
|
|
|
70
73
|
...localPatternSet.schemas.affirmative,
|
|
71
74
|
]) &&
|
|
72
75
|
!matchesAnyNegatedPattern(path, [...globalPatternSet.schemas.negated, ...localPatternSet.schemas.negated])) {
|
|
73
|
-
return
|
|
76
|
+
return generatesPath;
|
|
74
77
|
}
|
|
75
78
|
// Otherwise, there is no match
|
|
76
79
|
return false;
|
|
77
80
|
};
|
|
78
81
|
});
|
|
79
|
-
/**
|
|
80
|
-
* Return `true` if `path` should trigger a rebuild
|
|
81
|
-
*/
|
|
82
82
|
return ({ path: absolutePath }) => {
|
|
83
83
|
if (!(0, path_1.isAbsolute)(absolutePath)) {
|
|
84
84
|
throw new Error('shouldRebuild trigger should be called with absolute path');
|
|
85
85
|
}
|
|
86
86
|
const path = (0, path_1.relative)(process.cwd(), absolutePath);
|
|
87
|
-
const
|
|
88
|
-
|
|
87
|
+
const generatesKeysToRebuild = {};
|
|
88
|
+
for (const matcher of localMatchers) {
|
|
89
|
+
const result = matcher(path);
|
|
90
|
+
if (result) {
|
|
91
|
+
generatesKeysToRebuild[result] = true;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return generatesKeysToRebuild;
|
|
89
95
|
};
|
|
90
96
|
};
|
|
91
97
|
exports.makeShouldRebuild = makeShouldRebuild;
|
package/cjs/utils/watcher.js
CHANGED
|
@@ -26,10 +26,14 @@ const createWatcher = (initialContext, onNext) => {
|
|
|
26
26
|
(0, debugging_js_1.debugLog)(`[Watcher] Starting watcher...`);
|
|
27
27
|
let config = initialContext.getConfig();
|
|
28
28
|
const globalPatternSet = (0, patterns_js_1.makeGlobalPatternSet)(initialContext);
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
const localPatternSetArray = [];
|
|
30
|
+
const localPatternSets = Object.entries(config.generates).reduce((res, [filename, conf]) => {
|
|
31
|
+
const patternSet = (0, patterns_js_1.makeLocalPatternSet)((0, plugin_helpers_1.normalizeOutputParam)(conf));
|
|
32
|
+
res[filename] = patternSet;
|
|
33
|
+
localPatternSetArray.push(patternSet);
|
|
34
|
+
return res;
|
|
35
|
+
}, {});
|
|
36
|
+
const allAffirmativePatterns = (0, patterns_js_1.allAffirmativePatternsFromPatternSets)([globalPatternSet, ...localPatternSetArray]);
|
|
33
37
|
const shouldRebuild = (0, patterns_js_1.makeShouldRebuild)({ globalPatternSet, localPatternSets });
|
|
34
38
|
let watcherSubscription;
|
|
35
39
|
const runWatcher = async (abortSignal) => {
|
|
@@ -45,9 +49,9 @@ const createWatcher = (initialContext, onNext) => {
|
|
|
45
49
|
}
|
|
46
50
|
(0, debugging_js_1.debugLog)(`[Watcher] Parcel watcher loaded...`);
|
|
47
51
|
let isShutdown = false;
|
|
48
|
-
const debouncedExec = (0, debounce_1.default)(() => {
|
|
52
|
+
const debouncedExec = (0, debounce_1.default)((generatesKeysToRebuild) => {
|
|
49
53
|
if (!isShutdown) {
|
|
50
|
-
(0, codegen_js_1.executeCodegen)(initialContext)
|
|
54
|
+
(0, codegen_js_1.executeCodegen)(initialContext, { onlyGeneratesKeys: generatesKeysToRebuild })
|
|
51
55
|
.then(({ result, error }) => {
|
|
52
56
|
// FIXME: this is a quick fix to stop `onNext` (writeOutput) from
|
|
53
57
|
// removing all files when there is an error.
|
|
@@ -86,11 +90,11 @@ const createWatcher = (initialContext, onNext) => {
|
|
|
86
90
|
}
|
|
87
91
|
}
|
|
88
92
|
watcherSubscription = await parcelWatcher.subscribe(watchDirectory, async (_, events) => {
|
|
89
|
-
// it doesn't matter what has changed, need to run whole process anyway
|
|
90
93
|
await Promise.all(
|
|
91
94
|
// NOTE: @parcel/watcher always provides path as an absolute path
|
|
92
95
|
events.map(async ({ type: eventName, path }) => {
|
|
93
|
-
|
|
96
|
+
const generatesKeysToRebuild = shouldRebuild({ path });
|
|
97
|
+
if (Object.keys(generatesKeysToRebuild).length === 0) {
|
|
94
98
|
return;
|
|
95
99
|
}
|
|
96
100
|
(0, hooks_js_1.lifecycleHooks)(config.hooks).onWatchTriggered(eventName, path);
|
|
@@ -111,7 +115,7 @@ const createWatcher = (initialContext, onNext) => {
|
|
|
111
115
|
config = newParsedConfig;
|
|
112
116
|
initialContext.updateConfig(config);
|
|
113
117
|
}
|
|
114
|
-
debouncedExec();
|
|
118
|
+
debouncedExec(generatesKeysToRebuild);
|
|
115
119
|
}));
|
|
116
120
|
}, { ignore: ignored });
|
|
117
121
|
(0, debugging_js_1.debugLog)(`[Watcher] Started`);
|
package/esm/codegen.js
CHANGED
|
@@ -47,7 +47,7 @@ function createCache() {
|
|
|
47
47
|
return value;
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
-
export async function executeCodegen(input) {
|
|
50
|
+
export async function executeCodegen(input, options = { onlyGeneratesKeys: {} }) {
|
|
51
51
|
const context = ensureContext(input);
|
|
52
52
|
const config = context.getConfig();
|
|
53
53
|
const pluginContext = context.getPluginContext();
|
|
@@ -146,7 +146,14 @@ export async function executeCodegen(input) {
|
|
|
146
146
|
{
|
|
147
147
|
title: 'Generate outputs',
|
|
148
148
|
task: (ctx, task) => {
|
|
149
|
-
const
|
|
149
|
+
const originalGeneratesKeys = Object.keys(generates);
|
|
150
|
+
const foundGeneratesKeys = originalGeneratesKeys.filter(generatesKey => options.onlyGeneratesKeys[generatesKey]);
|
|
151
|
+
const effectiveGeneratesKeys = foundGeneratesKeys.length === 0 ? originalGeneratesKeys : foundGeneratesKeys;
|
|
152
|
+
const hasFilteredDownGeneratesKeys = originalGeneratesKeys.length > effectiveGeneratesKeys.length;
|
|
153
|
+
if (hasFilteredDownGeneratesKeys) {
|
|
154
|
+
debugLog(`[CLI] Generating partial config:\n${effectiveGeneratesKeys.map(key => `- ${key}`).join('\n')}`);
|
|
155
|
+
}
|
|
156
|
+
const generateTasks = effectiveGeneratesKeys.map(filename => {
|
|
150
157
|
const outputConfig = generates[filename];
|
|
151
158
|
const hasPreset = !!outputConfig.preset;
|
|
152
159
|
const title = `Generate to ${filename}`;
|
package/esm/utils/patterns.js
CHANGED
|
@@ -34,9 +34,12 @@ export const allAffirmativePatternsFromPatternSets = (patternSets) => {
|
|
|
34
34
|
* a match even if it would be negated by some pattern in documents or schemas
|
|
35
35
|
* * The trigger returns true if any output target's local patterns result in
|
|
36
36
|
* a match, after considering the precedence of any global and local negations
|
|
37
|
+
*
|
|
38
|
+
* The result is a function that when given an absolute path,
|
|
39
|
+
* it will tell which generates blocks' keys are affected so we can re-run for those keys
|
|
37
40
|
*/
|
|
38
41
|
export const makeShouldRebuild = ({ globalPatternSet, localPatternSets, }) => {
|
|
39
|
-
const localMatchers = localPatternSets.map(localPatternSet => {
|
|
42
|
+
const localMatchers = Object.entries(localPatternSets).map(([generatesPath, localPatternSet]) => {
|
|
40
43
|
return (path) => {
|
|
41
44
|
// Is path negated by any negating watch pattern?
|
|
42
45
|
if (matchesAnyNegatedPattern(path, [...globalPatternSet.watch.negated, ...localPatternSet.watch.negated])) {
|
|
@@ -49,7 +52,7 @@ export const makeShouldRebuild = ({ globalPatternSet, localPatternSets, }) => {
|
|
|
49
52
|
...localPatternSet.watch.affirmative,
|
|
50
53
|
])) {
|
|
51
54
|
// Immediately return true: Watch pattern takes priority, even if documents or schema would negate it
|
|
52
|
-
return
|
|
55
|
+
return generatesPath;
|
|
53
56
|
}
|
|
54
57
|
// Does path match documents patterns (without being negated)?
|
|
55
58
|
if (matchesAnyAffirmativePattern(path, [
|
|
@@ -57,7 +60,7 @@ export const makeShouldRebuild = ({ globalPatternSet, localPatternSets, }) => {
|
|
|
57
60
|
...localPatternSet.documents.affirmative,
|
|
58
61
|
]) &&
|
|
59
62
|
!matchesAnyNegatedPattern(path, [...globalPatternSet.documents.negated, ...localPatternSet.documents.negated])) {
|
|
60
|
-
return
|
|
63
|
+
return generatesPath;
|
|
61
64
|
}
|
|
62
65
|
// Does path match schemas patterns (without being negated)?
|
|
63
66
|
if (matchesAnyAffirmativePattern(path, [
|
|
@@ -65,22 +68,25 @@ export const makeShouldRebuild = ({ globalPatternSet, localPatternSets, }) => {
|
|
|
65
68
|
...localPatternSet.schemas.affirmative,
|
|
66
69
|
]) &&
|
|
67
70
|
!matchesAnyNegatedPattern(path, [...globalPatternSet.schemas.negated, ...localPatternSet.schemas.negated])) {
|
|
68
|
-
return
|
|
71
|
+
return generatesPath;
|
|
69
72
|
}
|
|
70
73
|
// Otherwise, there is no match
|
|
71
74
|
return false;
|
|
72
75
|
};
|
|
73
76
|
});
|
|
74
|
-
/**
|
|
75
|
-
* Return `true` if `path` should trigger a rebuild
|
|
76
|
-
*/
|
|
77
77
|
return ({ path: absolutePath }) => {
|
|
78
78
|
if (!isAbsolute(absolutePath)) {
|
|
79
79
|
throw new Error('shouldRebuild trigger should be called with absolute path');
|
|
80
80
|
}
|
|
81
81
|
const path = relative(process.cwd(), absolutePath);
|
|
82
|
-
const
|
|
83
|
-
|
|
82
|
+
const generatesKeysToRebuild = {};
|
|
83
|
+
for (const matcher of localMatchers) {
|
|
84
|
+
const result = matcher(path);
|
|
85
|
+
if (result) {
|
|
86
|
+
generatesKeysToRebuild[result] = true;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return generatesKeysToRebuild;
|
|
84
90
|
};
|
|
85
91
|
};
|
|
86
92
|
/**
|
package/esm/utils/watcher.js
CHANGED
|
@@ -22,10 +22,14 @@ export const createWatcher = (initialContext, onNext) => {
|
|
|
22
22
|
debugLog(`[Watcher] Starting watcher...`);
|
|
23
23
|
let config = initialContext.getConfig();
|
|
24
24
|
const globalPatternSet = makeGlobalPatternSet(initialContext);
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
const localPatternSetArray = [];
|
|
26
|
+
const localPatternSets = Object.entries(config.generates).reduce((res, [filename, conf]) => {
|
|
27
|
+
const patternSet = makeLocalPatternSet(normalizeOutputParam(conf));
|
|
28
|
+
res[filename] = patternSet;
|
|
29
|
+
localPatternSetArray.push(patternSet);
|
|
30
|
+
return res;
|
|
31
|
+
}, {});
|
|
32
|
+
const allAffirmativePatterns = allAffirmativePatternsFromPatternSets([globalPatternSet, ...localPatternSetArray]);
|
|
29
33
|
const shouldRebuild = makeShouldRebuild({ globalPatternSet, localPatternSets });
|
|
30
34
|
let watcherSubscription;
|
|
31
35
|
const runWatcher = async (abortSignal) => {
|
|
@@ -41,9 +45,9 @@ export const createWatcher = (initialContext, onNext) => {
|
|
|
41
45
|
}
|
|
42
46
|
debugLog(`[Watcher] Parcel watcher loaded...`);
|
|
43
47
|
let isShutdown = false;
|
|
44
|
-
const debouncedExec = debounce(() => {
|
|
48
|
+
const debouncedExec = debounce((generatesKeysToRebuild) => {
|
|
45
49
|
if (!isShutdown) {
|
|
46
|
-
executeCodegen(initialContext)
|
|
50
|
+
executeCodegen(initialContext, { onlyGeneratesKeys: generatesKeysToRebuild })
|
|
47
51
|
.then(({ result, error }) => {
|
|
48
52
|
// FIXME: this is a quick fix to stop `onNext` (writeOutput) from
|
|
49
53
|
// removing all files when there is an error.
|
|
@@ -82,11 +86,11 @@ export const createWatcher = (initialContext, onNext) => {
|
|
|
82
86
|
}
|
|
83
87
|
}
|
|
84
88
|
watcherSubscription = await parcelWatcher.subscribe(watchDirectory, async (_, events) => {
|
|
85
|
-
// it doesn't matter what has changed, need to run whole process anyway
|
|
86
89
|
await Promise.all(
|
|
87
90
|
// NOTE: @parcel/watcher always provides path as an absolute path
|
|
88
91
|
events.map(async ({ type: eventName, path }) => {
|
|
89
|
-
|
|
92
|
+
const generatesKeysToRebuild = shouldRebuild({ path });
|
|
93
|
+
if (Object.keys(generatesKeysToRebuild).length === 0) {
|
|
90
94
|
return;
|
|
91
95
|
}
|
|
92
96
|
lifecycleHooks(config.hooks).onWatchTriggered(eventName, path);
|
|
@@ -107,7 +111,7 @@ export const createWatcher = (initialContext, onNext) => {
|
|
|
107
111
|
config = newParsedConfig;
|
|
108
112
|
initialContext.updateConfig(config);
|
|
109
113
|
}
|
|
110
|
-
debouncedExec();
|
|
114
|
+
debouncedExec(generatesKeysToRebuild);
|
|
111
115
|
}));
|
|
112
116
|
}, { ignore: ignored });
|
|
113
117
|
debugLog(`[Watcher] Started`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/cli",
|
|
3
|
-
"version": "6.0
|
|
3
|
+
"version": "6.1.0-alpha-20251107131717-adc4d901f6e53e023001b84e0cef353e6dad8629",
|
|
4
4
|
"peerDependenciesMeta": {
|
|
5
5
|
"@parcel/watcher": {
|
|
6
6
|
"optional": true
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"@graphql-tools/apollo-engine-loader": "^8.0.0",
|
|
21
21
|
"@graphql-tools/code-file-loader": "^8.0.0",
|
|
22
22
|
"@graphql-tools/git-loader": "^8.0.0",
|
|
23
|
-
"@graphql-tools/github-loader": "^
|
|
23
|
+
"@graphql-tools/github-loader": "^8.0.0",
|
|
24
24
|
"@graphql-tools/graphql-file-loader": "^8.0.0",
|
|
25
25
|
"@graphql-tools/json-file-loader": "^8.0.0",
|
|
26
26
|
"@graphql-tools/load": "^8.1.0",
|
|
27
|
-
"@graphql-tools/url-loader": "^
|
|
27
|
+
"@graphql-tools/url-loader": "^8.0.0",
|
|
28
28
|
"@graphql-tools/utils": "^10.0.0",
|
|
29
29
|
"@inquirer/prompts": "^7.8.2",
|
|
30
30
|
"@whatwg-node/fetch": "^0.10.0",
|
package/typings/codegen.d.cts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Types } from '@graphql-codegen/plugin-helpers';
|
|
2
2
|
import { CodegenContext } from './config.cjs';
|
|
3
|
-
export declare function executeCodegen(input: CodegenContext | Types.Config
|
|
3
|
+
export declare function executeCodegen(input: CodegenContext | Types.Config, options?: {
|
|
4
|
+
onlyGeneratesKeys: Record<string, true>;
|
|
5
|
+
}): Promise<{
|
|
4
6
|
result: Types.FileOutput[];
|
|
5
7
|
error: Error | null;
|
|
6
8
|
}>;
|
package/typings/codegen.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Types } from '@graphql-codegen/plugin-helpers';
|
|
2
2
|
import { CodegenContext } from './config.js';
|
|
3
|
-
export declare function executeCodegen(input: CodegenContext | Types.Config
|
|
3
|
+
export declare function executeCodegen(input: CodegenContext | Types.Config, options?: {
|
|
4
|
+
onlyGeneratesKeys: Record<string, true>;
|
|
5
|
+
}): Promise<{
|
|
4
6
|
result: Types.FileOutput[];
|
|
5
7
|
error: Error | null;
|
|
6
8
|
}>;
|
|
@@ -25,13 +25,16 @@ export declare const allAffirmativePatternsFromPatternSets: (patternSets: Patter
|
|
|
25
25
|
* a match even if it would be negated by some pattern in documents or schemas
|
|
26
26
|
* * The trigger returns true if any output target's local patterns result in
|
|
27
27
|
* a match, after considering the precedence of any global and local negations
|
|
28
|
+
*
|
|
29
|
+
* The result is a function that when given an absolute path,
|
|
30
|
+
* it will tell which generates blocks' keys are affected so we can re-run for those keys
|
|
28
31
|
*/
|
|
29
32
|
export declare const makeShouldRebuild: ({ globalPatternSet, localPatternSets, }: {
|
|
30
33
|
globalPatternSet: PatternSet;
|
|
31
|
-
localPatternSets: PatternSet
|
|
32
|
-
}) => (
|
|
34
|
+
localPatternSets: Record<string, PatternSet>;
|
|
35
|
+
}) => ((params: {
|
|
33
36
|
path: string;
|
|
34
|
-
}) =>
|
|
37
|
+
}) => Record<string, true>);
|
|
35
38
|
/**
|
|
36
39
|
* Create the pattern set for the "global" (top level) config.
|
|
37
40
|
*
|
|
@@ -52,11 +55,7 @@ export declare const makeGlobalPatternSet: (initialContext: CodegenContext) => {
|
|
|
52
55
|
* patterns will be mixed into the pattern set of their respective gobal pattern
|
|
53
56
|
* set equivalents.
|
|
54
57
|
*/
|
|
55
|
-
export declare const makeLocalPatternSet: (conf: Types.ConfiguredOutput) =>
|
|
56
|
-
watch: SortedPatterns<string>;
|
|
57
|
-
documents: SortedPatterns<string>;
|
|
58
|
-
schemas: SortedPatterns<string>;
|
|
59
|
-
};
|
|
58
|
+
export declare const makeLocalPatternSet: (conf: Types.ConfiguredOutput) => PatternSet;
|
|
60
59
|
/**
|
|
61
60
|
* Given a list of micromatch patterns, sort them into `patterns` (all of them),
|
|
62
61
|
* `affirmative` (only the affirmative patterns), and `negated` (only the negated patterns)
|
|
@@ -83,7 +82,7 @@ type SortedPatterns<PP extends string | NegatedPattern = string | NegatedPattern
|
|
|
83
82
|
* patterns which are separable into "watch" (always takes precedence), "documents",
|
|
84
83
|
* and "schemas". This type can hold sorted versions of these patterns.
|
|
85
84
|
*/
|
|
86
|
-
type PatternSet = {
|
|
85
|
+
export type PatternSet = {
|
|
87
86
|
watch: SortedPatterns;
|
|
88
87
|
documents: SortedPatterns;
|
|
89
88
|
schemas: SortedPatterns;
|
|
@@ -25,13 +25,16 @@ export declare const allAffirmativePatternsFromPatternSets: (patternSets: Patter
|
|
|
25
25
|
* a match even if it would be negated by some pattern in documents or schemas
|
|
26
26
|
* * The trigger returns true if any output target's local patterns result in
|
|
27
27
|
* a match, after considering the precedence of any global and local negations
|
|
28
|
+
*
|
|
29
|
+
* The result is a function that when given an absolute path,
|
|
30
|
+
* it will tell which generates blocks' keys are affected so we can re-run for those keys
|
|
28
31
|
*/
|
|
29
32
|
export declare const makeShouldRebuild: ({ globalPatternSet, localPatternSets, }: {
|
|
30
33
|
globalPatternSet: PatternSet;
|
|
31
|
-
localPatternSets: PatternSet
|
|
32
|
-
}) => (
|
|
34
|
+
localPatternSets: Record<string, PatternSet>;
|
|
35
|
+
}) => ((params: {
|
|
33
36
|
path: string;
|
|
34
|
-
}) =>
|
|
37
|
+
}) => Record<string, true>);
|
|
35
38
|
/**
|
|
36
39
|
* Create the pattern set for the "global" (top level) config.
|
|
37
40
|
*
|
|
@@ -52,11 +55,7 @@ export declare const makeGlobalPatternSet: (initialContext: CodegenContext) => {
|
|
|
52
55
|
* patterns will be mixed into the pattern set of their respective gobal pattern
|
|
53
56
|
* set equivalents.
|
|
54
57
|
*/
|
|
55
|
-
export declare const makeLocalPatternSet: (conf: Types.ConfiguredOutput) =>
|
|
56
|
-
watch: SortedPatterns<string>;
|
|
57
|
-
documents: SortedPatterns<string>;
|
|
58
|
-
schemas: SortedPatterns<string>;
|
|
59
|
-
};
|
|
58
|
+
export declare const makeLocalPatternSet: (conf: Types.ConfiguredOutput) => PatternSet;
|
|
60
59
|
/**
|
|
61
60
|
* Given a list of micromatch patterns, sort them into `patterns` (all of them),
|
|
62
61
|
* `affirmative` (only the affirmative patterns), and `negated` (only the negated patterns)
|
|
@@ -83,7 +82,7 @@ type SortedPatterns<PP extends string | NegatedPattern = string | NegatedPattern
|
|
|
83
82
|
* patterns which are separable into "watch" (always takes precedence), "documents",
|
|
84
83
|
* and "schemas". This type can hold sorted versions of these patterns.
|
|
85
84
|
*/
|
|
86
|
-
type PatternSet = {
|
|
85
|
+
export type PatternSet = {
|
|
87
86
|
watch: SortedPatterns;
|
|
88
87
|
documents: SortedPatterns;
|
|
89
88
|
schemas: SortedPatterns;
|