@content-collections/vite 0.2.6 → 0.2.8

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.
@@ -1,14 +1,12 @@
1
1
 
2
- > @content-collections/vite@0.2.6 build /home/runner/work/content-collections/content-collections/packages/vite
3
- > tsup src/index.ts --format esm --dts -d dist
2
+ > @content-collections/vite@0.2.8 build /home/runner/work/content-collections/content-collections/packages/vite
3
+ > tsdown src/index.ts --format esm --dts -d dist
4
4
 
5
- CLI Building entry: src/index.ts
6
- CLI Using tsconfig: tsconfig.json
7
- CLI tsup v8.2.4
8
- CLI Target: es2022
9
- ESM Build start
10
- ESM dist/index.js 2.08 KB
11
- ESM ⚡️ Build success in 76ms
12
- DTS Build start
13
- DTS ⚡️ Build success in 3364ms
14
- DTS dist/index.d.ts 279.00 B
5
+ ℹ tsdown v0.15.12 powered by rolldown v1.0.0-beta.45
6
+ ℹ entry: src/index.ts
7
+ ℹ tsconfig: tsconfig.json
8
+ ℹ Build start
9
+ ℹ dist/index.js 1.78 kB │ gzip: 0.66 kB
10
+ ℹ dist/index.d.ts 0.31 kB │ gzip: 0.21 kB
11
+ ℹ 2 files, total: 2.08 kB
12
+ ✔ Build complete in 4247ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @content-collections/vite
2
2
 
3
+ ## 0.2.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`92abb38`](https://github.com/sdorra/content-collections/commit/92abb380a8c39c558a5fc10ac347008b8a4ceb03)]:
8
+ - @content-collections/integrations@0.4.0
9
+
10
+ ## 0.2.7
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`86490bc`](https://github.com/sdorra/content-collections/commit/86490bc8815ba03ede8c3a9dcb45931cd686db9c)]:
15
+ - @content-collections/integrations@0.3.0
16
+
3
17
  ## 0.2.6
4
18
 
5
19
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- import { UserConfig, Plugin } from 'vite';
1
+ import { Plugin, UserConfig } from "vite";
2
2
 
3
+ //#region src/index.d.ts
3
4
  type Options = {
4
- configPath: string;
5
- isEnabled?: (config: UserConfig) => boolean;
5
+ configPath: string;
6
+ isEnabled?: (config: UserConfig) => boolean;
6
7
  };
7
8
  declare function contentCollectionsPlugin(options?: Partial<Options>): Plugin;
8
-
9
- export { type Options, contentCollectionsPlugin as default };
9
+ //#endregion
10
+ export { Options, contentCollectionsPlugin as default };
package/dist/index.js CHANGED
@@ -1,83 +1,53 @@
1
- // src/index.ts
2
1
  import { createBuilder } from "@content-collections/core";
3
2
  import { configureLogging } from "@content-collections/integrations";
4
3
  import path from "node:path";
5
- var defaultOptions = {
6
- configPath: "content-collections.ts"
7
- };
4
+
5
+ //#region src/index.ts
6
+ const defaultOptions = { configPath: "content-collections.ts" };
8
7
  function resolveConfigPath(root, configPath) {
9
- if (!path.isAbsolute(configPath)) {
10
- configPath = path.resolve(root, configPath);
11
- }
12
- return configPath;
8
+ if (!path.isAbsolute(configPath)) configPath = path.resolve(root, configPath);
9
+ return configPath;
13
10
  }
14
11
  function contentCollectionsPlugin(options = {}) {
15
- const pluginOptions = { ...defaultOptions, ...options };
16
- let builder;
17
- function isEnabled(config) {
18
- return options.isEnabled ? options.isEnabled(config) : true;
19
- }
20
- return {
21
- name: "content-collections",
22
- config(config) {
23
- let configPath = resolveConfigPath(
24
- config.root || process.cwd(),
25
- pluginOptions.configPath
26
- );
27
- const directory = path.resolve(
28
- path.dirname(configPath),
29
- "./.content-collections/generated"
30
- );
31
- const configPatch = {
32
- optimizeDeps: {
33
- exclude: ["content-collections"]
34
- },
35
- resolve: {
36
- alias: {
37
- "content-collections": directory
38
- }
39
- }
40
- };
41
- if ((config.server?.fs?.allow || []).length > 0) {
42
- configPatch.server = {
43
- fs: {
44
- allow: [directory]
45
- }
46
- };
47
- }
48
- return configPatch;
49
- },
50
- async configResolved(config) {
51
- if (!isEnabled(config)) {
52
- return;
53
- }
54
- let configPath = resolveConfigPath(config.root, pluginOptions.configPath);
55
- console.log(
56
- "Starting content-collections with config",
57
- path.relative(process.cwd(), configPath)
58
- );
59
- builder = await createBuilder(configPath);
60
- configureLogging(builder);
61
- return;
62
- },
63
- async buildStart() {
64
- if (!builder) {
65
- return;
66
- }
67
- console.log("Start initial build");
68
- await builder.build();
69
- return;
70
- },
71
- async configureServer() {
72
- if (!builder) {
73
- return;
74
- }
75
- console.log("Start watching");
76
- builder.watch();
77
- return;
78
- }
79
- };
12
+ const pluginOptions = {
13
+ ...defaultOptions,
14
+ ...options
15
+ };
16
+ let builder;
17
+ function isEnabled(config) {
18
+ return options.isEnabled ? options.isEnabled(config) : true;
19
+ }
20
+ return {
21
+ name: "content-collections",
22
+ config(config) {
23
+ let configPath = resolveConfigPath(config.root || process.cwd(), pluginOptions.configPath);
24
+ const directory = path.resolve(path.dirname(configPath), "./.content-collections/generated");
25
+ const configPatch = {
26
+ optimizeDeps: { exclude: ["content-collections"] },
27
+ resolve: { alias: { "content-collections": directory } }
28
+ };
29
+ if ((config.server?.fs?.allow || []).length > 0) configPatch.server = { fs: { allow: [directory] } };
30
+ return configPatch;
31
+ },
32
+ async configResolved(config) {
33
+ if (!isEnabled(config)) return;
34
+ let configPath = resolveConfigPath(config.root, pluginOptions.configPath);
35
+ console.log("Starting content-collections with config", path.relative(process.cwd(), configPath));
36
+ builder = await createBuilder(configPath);
37
+ configureLogging(builder);
38
+ },
39
+ async buildStart() {
40
+ if (!builder) return;
41
+ console.log("Start initial build");
42
+ await builder.build();
43
+ },
44
+ async configureServer() {
45
+ if (!builder) return;
46
+ console.log("Start watching");
47
+ builder.watch();
48
+ }
49
+ };
80
50
  }
81
- export {
82
- contentCollectionsPlugin as default
83
- };
51
+
52
+ //#endregion
53
+ export { contentCollectionsPlugin as default };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@content-collections/vite",
3
3
  "type": "module",
4
- "version": "0.2.6",
4
+ "version": "0.2.8",
5
5
  "description": "Use content-collections with Vite",
6
6
  "author": "Sebastian Sdorra <s.sdorra@gmail.com>",
7
7
  "license": "MIT",
@@ -22,20 +22,20 @@
22
22
  }
23
23
  },
24
24
  "dependencies": {
25
- "@content-collections/integrations": "0.2.1"
25
+ "@content-collections/integrations": "0.4.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "20.x",
29
- "tsup": "^8.2.4",
29
+ "tsdown": "^0.15.12",
30
30
  "typescript": "^5.5.4",
31
- "vite": "^5.4.6",
32
- "@content-collections/core": "0.10.0"
31
+ "vite": "^5.4.21",
32
+ "@content-collections/core": "0.13.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@content-collections/core": "^0.x",
36
36
  "vite": "^5 || ^6 || ^7"
37
37
  },
38
38
  "scripts": {
39
- "build": "tsup src/index.ts --format esm --dts -d dist"
39
+ "build": "tsdown src/index.ts --format esm --dts -d dist"
40
40
  }
41
41
  }