@content-collections/core 0.15.3 → 0.15.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +15 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1071,6 +1071,7 @@ declare function createBuilder(configurationPath: string, options?: Options$1, e
|
|
|
1071
1071
|
watch: () => Promise<{
|
|
1072
1072
|
unsubscribe: () => Promise<void>;
|
|
1073
1073
|
}>;
|
|
1074
|
+
watchPaths: () => string[];
|
|
1074
1075
|
on: {
|
|
1075
1076
|
<TKey extends "builder:start" | "builder:end" | "builder:created" | "watcher:file-changed" | "watcher:config-changed" | "watcher:config-reload-error" | "collector:read-error" | "collector:parse-error" | "transformer:validation-error" | "transformer:singleton-warning" | "transformer:result-error" | "transformer:error" | "transformer:document-skipped" | "watcher:subscribe-error" | "watcher:subscribed" | "watcher:unsubscribed">(key: TKey, listener: (event: Events[TKey]) => void): void;
|
|
1076
1077
|
<TKey extends "_error" | "_all">(key: TKey, listener: (event: SystemEvents[TKey]) => void): void;
|
|
@@ -1082,6 +1083,7 @@ declare function createInternalBuilder(initialConfiguration: InternalConfigurati
|
|
|
1082
1083
|
watch: () => Promise<{
|
|
1083
1084
|
unsubscribe: () => Promise<void>;
|
|
1084
1085
|
}>;
|
|
1086
|
+
watchPaths: () => string[];
|
|
1085
1087
|
on: {
|
|
1086
1088
|
<TKey extends "builder:start" | "builder:end" | "builder:created" | "watcher:file-changed" | "watcher:config-changed" | "watcher:config-reload-error" | "collector:read-error" | "collector:parse-error" | "transformer:validation-error" | "transformer:singleton-warning" | "transformer:result-error" | "transformer:error" | "transformer:document-skipped" | "watcher:subscribe-error" | "watcher:subscribed" | "watcher:unsubscribed">(key: TKey, listener: (event: Events[TKey]) => void): void;
|
|
1087
1089
|
<TKey extends "_error" | "_all">(key: TKey, listener: (event: SystemEvents[TKey]) => void): void;
|
package/dist/index.js
CHANGED
|
@@ -266,9 +266,16 @@ var match = (id, patterns) => {
|
|
|
266
266
|
|
|
267
267
|
//#endregion
|
|
268
268
|
//#region src/esbuild.ts
|
|
269
|
+
function safeLoadTsConfig(directory) {
|
|
270
|
+
try {
|
|
271
|
+
return directory ? loadTsConfig(directory) : loadTsConfig();
|
|
272
|
+
} catch {
|
|
273
|
+
return null;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
269
276
|
function tsconfigResolvePaths(configPath) {
|
|
270
|
-
let tsconfig =
|
|
271
|
-
if (!tsconfig) tsconfig =
|
|
277
|
+
let tsconfig = safeLoadTsConfig(dirname(configPath));
|
|
278
|
+
if (!tsconfig) tsconfig = safeLoadTsConfig();
|
|
272
279
|
return tsconfig?.data?.compilerOptions?.paths || {};
|
|
273
280
|
}
|
|
274
281
|
const NON_NODE_MODULE_RE = /^[A-Z]:[/\\]|^\.{0,2}\/|^\.{1,2}$/;
|
|
@@ -2287,11 +2294,14 @@ function createEmitter() {
|
|
|
2287
2294
|
|
|
2288
2295
|
//#endregion
|
|
2289
2296
|
//#region src/watcher.ts
|
|
2290
|
-
|
|
2291
|
-
|
|
2297
|
+
function resolveWatchPaths(baseDirectory, configuration) {
|
|
2298
|
+
return removeChildPaths([...configuration.collections.map((collection) => {
|
|
2292
2299
|
const directory = isSingleton(collection) ? path.dirname(collection.filePath) : collection.directory;
|
|
2293
2300
|
return path.join(baseDirectory, directory);
|
|
2294
2301
|
}).map((p) => resolve(p)), ...configuration.inputPaths.map((p) => dirname(p))]);
|
|
2302
|
+
}
|
|
2303
|
+
async function createWatcher(emitter, baseDirectory, configuration, sync) {
|
|
2304
|
+
const paths = resolveWatchPaths(baseDirectory, configuration);
|
|
2295
2305
|
function isInsideWatchPath(filePath, watchPath) {
|
|
2296
2306
|
const relativePath = path.relative(watchPath, filePath);
|
|
2297
2307
|
return relativePath !== "" && !relativePath.startsWith("..") && !path.isAbsolute(relativePath);
|
|
@@ -2439,6 +2449,7 @@ async function createInternalBuilder(initialConfiguration, baseDirectory, option
|
|
|
2439
2449
|
build: () => build$1(context),
|
|
2440
2450
|
sync,
|
|
2441
2451
|
watch,
|
|
2452
|
+
watchPaths: () => resolveWatchPaths(baseDirectory, configuration),
|
|
2442
2453
|
on: emitter.on
|
|
2443
2454
|
};
|
|
2444
2455
|
}
|