@content-collections/vite 0.1.1 → 0.1.2
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/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +6 -0
- package/dist/index.js +17 -9
- package/package.json +1 -1
- package/src/index.ts +23 -10
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @content-collections/vite@0.1.
|
|
2
|
+
> @content-collections/vite@0.1.1 build /Users/sdorra/Projects/sdorra/content-collections/packages/vite
|
|
3
3
|
> tsup src/index.ts --format esm --dts -d dist
|
|
4
4
|
|
|
5
5
|
CLI Building entry: src/index.ts
|
|
@@ -7,8 +7,8 @@ CLI Using tsconfig: tsconfig.json
|
|
|
7
7
|
CLI tsup v7.2.0
|
|
8
8
|
CLI Target: es2022
|
|
9
9
|
ESM Build start
|
|
10
|
-
ESM dist/index.js 1.
|
|
11
|
-
ESM ⚡️ Build success in
|
|
10
|
+
ESM dist/index.js 1.74 KB
|
|
11
|
+
ESM ⚡️ Build success in 9ms
|
|
12
12
|
DTS Build start
|
|
13
|
-
DTS ⚡️ Build success in
|
|
13
|
+
DTS ⚡️ Build success in 489ms
|
|
14
14
|
DTS dist/index.d.ts 195.00 B
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @content-collections/vite
|
|
2
2
|
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`7e0b2d6`](https://github.com/sdorra/content-collections/commit/7e0b2d621f2ab9c1244558ce1c36fe94e08dfdff) Thanks [@sdorra](https://github.com/sdorra)! - Add generated directory to list of allowed files. This required if vite is running with server.fs.strict.
|
|
8
|
+
|
|
3
9
|
## 0.1.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createBuilder } from "@content-collections/core";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { configureLogging } from "@content-collections/integrations";
|
|
5
|
-
function
|
|
5
|
+
function resolveConfigPath(root, configPath) {
|
|
6
6
|
if (!path.isAbsolute(configPath)) {
|
|
7
7
|
configPath = path.resolve(root, configPath);
|
|
8
8
|
}
|
|
@@ -15,27 +15,35 @@ function contentCollectionsPlugin(options = {
|
|
|
15
15
|
return {
|
|
16
16
|
name: "content-collections",
|
|
17
17
|
config(config) {
|
|
18
|
-
let configPath =
|
|
18
|
+
let configPath = resolveConfigPath(
|
|
19
19
|
config.root || process.cwd(),
|
|
20
20
|
options.configPath
|
|
21
21
|
);
|
|
22
|
-
const directory = path.
|
|
23
|
-
|
|
22
|
+
const directory = path.resolve(
|
|
23
|
+
path.dirname(configPath),
|
|
24
|
+
"./.content-collections/generated"
|
|
25
|
+
);
|
|
26
|
+
const configPatch = {
|
|
24
27
|
optimizeDeps: {
|
|
25
28
|
exclude: ["content-collections"]
|
|
26
29
|
},
|
|
27
30
|
resolve: {
|
|
28
31
|
alias: {
|
|
29
|
-
"content-collections":
|
|
30
|
-
directory,
|
|
31
|
-
"./.content-collections/generated/index.js"
|
|
32
|
-
)
|
|
32
|
+
"content-collections": directory
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
+
if ((config.server?.fs?.allow || []).length > 0) {
|
|
37
|
+
configPatch.server = {
|
|
38
|
+
fs: {
|
|
39
|
+
allow: [directory]
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return configPatch;
|
|
36
44
|
},
|
|
37
45
|
async configResolved(config) {
|
|
38
|
-
let configPath =
|
|
46
|
+
let configPath = resolveConfigPath(config.root, options.configPath);
|
|
39
47
|
console.log(
|
|
40
48
|
"Starting content-collections with config",
|
|
41
49
|
path.relative(process.cwd(), configPath)
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Builder, createBuilder } from "@content-collections/core";
|
|
2
|
-
import { Plugin } from "vite";
|
|
2
|
+
import { Plugin, UserConfig } from "vite";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { configureLogging } from "@content-collections/integrations";
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ type Options = {
|
|
|
7
7
|
configPath: string;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
function
|
|
10
|
+
function resolveConfigPath(root: string, configPath: string) {
|
|
11
11
|
if (!path.isAbsolute(configPath)) {
|
|
12
12
|
configPath = path.resolve(root, configPath);
|
|
13
13
|
}
|
|
@@ -24,28 +24,41 @@ export default function contentCollectionsPlugin(
|
|
|
24
24
|
name: "content-collections",
|
|
25
25
|
|
|
26
26
|
config(config) {
|
|
27
|
-
let configPath =
|
|
27
|
+
let configPath = resolveConfigPath(
|
|
28
28
|
config.root || process.cwd(),
|
|
29
29
|
options.configPath
|
|
30
30
|
);
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
|
|
32
|
+
const directory = path.resolve(
|
|
33
|
+
path.dirname(configPath),
|
|
34
|
+
"./.content-collections/generated"
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const configPatch: Partial<UserConfig> = {
|
|
33
38
|
optimizeDeps: {
|
|
34
39
|
exclude: ["content-collections"],
|
|
35
40
|
},
|
|
36
41
|
resolve: {
|
|
37
42
|
alias: {
|
|
38
|
-
"content-collections":
|
|
39
|
-
directory,
|
|
40
|
-
"./.content-collections/generated/index.js"
|
|
41
|
-
),
|
|
43
|
+
"content-collections": directory,
|
|
42
44
|
},
|
|
43
45
|
},
|
|
44
46
|
};
|
|
47
|
+
|
|
48
|
+
if ((config.server?.fs?.allow || []).length > 0) {
|
|
49
|
+
// required for Svelte Kit
|
|
50
|
+
configPatch.server = {
|
|
51
|
+
fs: {
|
|
52
|
+
allow: [directory],
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return configPatch;
|
|
45
58
|
},
|
|
46
59
|
|
|
47
60
|
async configResolved(config: any) {
|
|
48
|
-
let configPath =
|
|
61
|
+
let configPath = resolveConfigPath(config.root, options.configPath);
|
|
49
62
|
console.log(
|
|
50
63
|
"Starting content-collections with config",
|
|
51
64
|
path.relative(process.cwd(), configPath)
|