@content-collections/vite 0.2.2 → 0.2.4

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,14 @@
1
1
 
2
- > @content-collections/vite@0.2.2 build /home/runner/work/content-collections/content-collections/packages/vite
2
+ > @content-collections/vite@0.2.4 build /home/runner/work/content-collections/content-collections/packages/vite
3
3
  > tsup 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.0.2
8
- CLI Target: es2022
9
- ESM Build start
10
- ESM dist/index.js 2.07 KB
11
- ESM ⚡️ Build success in 51ms
12
- DTS Build start
13
- DTS ⚡️ Build success in 2544ms
14
- DTS dist/index.d.ts 279.00 B
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 42ms
12
+ DTS Build start
13
+ DTS ⚡️ Build success in 3173ms
14
+ DTS dist/index.d.ts 279.00 B
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @content-collections/vite
2
2
 
3
+ ## 0.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#458](https://github.com/sdorra/content-collections/pull/458) [`3abd5c0`](https://github.com/sdorra/content-collections/commit/3abd5c07774662929351de82071600f082d2650d) Thanks [@sdorra](https://github.com/sdorra)! - Fix double execution with vinxi
8
+
9
+ ## 0.2.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [#330](https://github.com/sdorra/content-collections/pull/330) [`b2c89ce`](https://github.com/sdorra/content-collections/commit/b2c89ce6075d9a5115486d8ff9c0b84f4c0841dd) Thanks [@sdorra](https://github.com/sdorra)! - Ensure types is exported before imports and require
14
+
15
+ - Updated dependencies [[`b2c89ce`](https://github.com/sdorra/content-collections/commit/b2c89ce6075d9a5115486d8ff9c0b84f4c0841dd)]:
16
+ - @content-collections/integrations@0.2.1
17
+
3
18
  ## 0.2.2
4
19
 
5
20
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // src/index.ts
2
2
  import { createBuilder } from "@content-collections/core";
3
- import path from "path";
4
3
  import { configureLogging } from "@content-collections/integrations";
4
+ import path from "node:path";
5
5
  var defaultOptions = {
6
6
  configPath: "content-collections.ts"
7
7
  };
@@ -14,11 +14,12 @@ function resolveConfigPath(root, configPath) {
14
14
  function contentCollectionsPlugin(options = {}) {
15
15
  const pluginOptions = { ...defaultOptions, ...options };
16
16
  let builder;
17
- let isEnabled = false;
17
+ function isEnabled(config) {
18
+ return options.isEnabled ? options.isEnabled(config) : true;
19
+ }
18
20
  return {
19
21
  name: "content-collections",
20
22
  config(config) {
21
- isEnabled = options.isEnabled ? options.isEnabled(config) : true;
22
23
  let configPath = resolveConfigPath(
23
24
  config.root || process.cwd(),
24
25
  pluginOptions.configPath
@@ -47,7 +48,7 @@ function contentCollectionsPlugin(options = {}) {
47
48
  return configPatch;
48
49
  },
49
50
  async configResolved(config) {
50
- if (!isEnabled) {
51
+ if (!isEnabled(config)) {
51
52
  return;
52
53
  }
53
54
  let configPath = resolveConfigPath(config.root, pluginOptions.configPath);
package/package.json CHANGED
@@ -1,26 +1,26 @@
1
1
  {
2
2
  "name": "@content-collections/vite",
3
3
  "description": "Use content-collections with Vite",
4
- "version": "0.2.2",
4
+ "version": "0.2.4",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "exports": {
9
9
  "./package.json": "./package.json",
10
10
  ".": {
11
- "import": "./dist/index.js",
12
- "types": "./dist/index.d.ts"
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
13
  }
14
14
  },
15
15
  "dependencies": {
16
- "@content-collections/integrations": "0.2.0"
16
+ "@content-collections/integrations": "0.2.1"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/node": "20.x",
20
- "tsup": "^8.0.2",
20
+ "tsup": "^8.2.4",
21
21
  "typescript": "^5.5.4",
22
- "vite": "^5.3.2",
23
- "@content-collections/core": "0.7.0"
22
+ "vite": "^5.4.6",
23
+ "@content-collections/core": "0.8.0"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "@content-collections/core": "^0.x",
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Builder, createBuilder } from "@content-collections/core";
2
- import { Plugin, UserConfig } from "vite";
3
- import path from "node:path";
4
2
  import { configureLogging } from "@content-collections/integrations";
3
+ import path from "node:path";
4
+ import { Plugin, UserConfig } from "vite";
5
5
 
6
6
  export type Options = {
7
7
  configPath: string;
@@ -20,31 +20,32 @@ function resolveConfigPath(root: string, configPath: string) {
20
20
  }
21
21
 
22
22
  export default function contentCollectionsPlugin(
23
- options: Partial<Options> = {}
23
+ options: Partial<Options> = {},
24
24
  ): Plugin {
25
25
  const pluginOptions = { ...defaultOptions, ...options };
26
26
 
27
27
  let builder: Builder;
28
- let isEnabled = false;
28
+
29
+ function isEnabled(config: UserConfig) {
30
+ return options.isEnabled ? options.isEnabled(config) : true;
31
+ }
29
32
 
30
33
  return {
31
34
  name: "content-collections",
32
35
 
33
36
  config(config) {
34
- isEnabled = options.isEnabled ? options.isEnabled(config) : true;
35
-
36
37
  // even if the plugin is disabled, we need to configure the alias
37
38
  // vite is often executed multiple time and the plugin should only
38
39
  // run once, but the aliases must be available for all runs
39
40
 
40
41
  let configPath = resolveConfigPath(
41
42
  config.root || process.cwd(),
42
- pluginOptions.configPath
43
+ pluginOptions.configPath,
43
44
  );
44
45
 
45
46
  const directory = path.resolve(
46
47
  path.dirname(configPath),
47
- "./.content-collections/generated"
48
+ "./.content-collections/generated",
48
49
  );
49
50
 
50
51
  const configPatch: Partial<UserConfig> = {
@@ -71,13 +72,13 @@ export default function contentCollectionsPlugin(
71
72
  },
72
73
 
73
74
  async configResolved(config: any) {
74
- if (!isEnabled) {
75
+ if (!isEnabled(config)) {
75
76
  return;
76
77
  }
77
78
  let configPath = resolveConfigPath(config.root, pluginOptions.configPath);
78
79
  console.log(
79
80
  "Starting content-collections with config",
80
- path.relative(process.cwd(), configPath)
81
+ path.relative(process.cwd(), configPath),
81
82
  );
82
83
 
83
84
  builder = await createBuilder(configPath);
package/tsconfig.json CHANGED
@@ -21,4 +21,4 @@
21
21
  /* If your code doesn't run in the DOM: */
22
22
  "lib": ["es2022"]
23
23
  }
24
- }
24
+ }