@md-plugins/vite-examples-plugin 0.1.0-beta.2 → 0.1.0-beta.21

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/README.md CHANGED
@@ -16,6 +16,8 @@ Install the plugin via your preferred package manager:
16
16
  ```bash
17
17
  # with pnpm
18
18
  pnpm add @md-plugins/vite-examples-plugin
19
+ # with bun
20
+ bun add @md-plugins/vite-examples-plugin
19
21
  # with yarn
20
22
  yarn add @md-plugins/vite-examples-plugin
21
23
  # with npm
@@ -62,9 +64,15 @@ export default defineConfig(({ mode }) => {
62
64
  ],
63
65
  build: {
64
66
  chunkSizeWarningLimit: 650,
65
- rollupOptions: {
67
+ rolldownOptions: {
66
68
  output: {
67
- manualChunks: viteManualChunks,
69
+ codeSplitting: {
70
+ groups: [
71
+ {
72
+ name: (moduleId) => viteManualChunks(moduleId) ?? null,
73
+ },
74
+ ],
75
+ },
68
76
  },
69
77
  },
70
78
  },
@@ -105,8 +113,14 @@ import { viteExamplesPlugin, viteManualChunks } from '@md-plugins/vite-examples-
105
113
  if (ctx.prod && isClient) {
106
114
  viteConf.build = viteConf.build || {}
107
115
  viteConf.build.chunkSizeWarningLimit = 650
108
- viteConf.build.rollupOptions = {
109
- output: { manualChunks: viteManualChunks },
116
+ viteConf.build.rolldownOptions = viteConf.build.rolldownOptions || {}
117
+ viteConf.build.rolldownOptions.output = viteConf.build.rolldownOptions.output || {}
118
+ viteConf.build.rolldownOptions.output.codeSplitting = {
119
+ groups: [
120
+ {
121
+ name: (moduleId) => viteManualChunks(moduleId) ?? null,
122
+ },
123
+ ],
110
124
  }
111
125
  }
112
126
  },
@@ -176,8 +190,8 @@ export const source = import.meta.glob('/src/examples/example1/*.vue', {
176
190
  In production, the plugin preloads example components and their raw source code, generating import and export statements:
177
191
 
178
192
  ```ts
179
- import Example1 from 'app/src/examples/example1/Example1.vue'
180
- import RawExample1 from 'app/src/examples/example1/Example1.vue?raw'
193
+ import Example1 from '@/examples/example1/Example1.vue'
194
+ import RawExample1 from '@/examples/example1/Example1.vue?raw'
181
195
 
182
196
  export { Example1, RawExample1 }
183
197
  ```
@@ -210,6 +224,13 @@ throw new Error('targetFolder is not defined')
210
224
 
211
225
  In case this README falls out of date, please refer to the [documentation](https://md-plugins.netlify.app/vite-plugins/vite-examples-plugin/overview) for the latest information.
212
226
 
227
+ ## Support
228
+
229
+ If vite-examples-plugin is useful in your workflow and you want to support ongoing maintenance:
230
+
231
+ GitHub Sponsors: https://github.com/sponsors/hawkeye64
232
+ PayPal: https://paypal.me/hawkeye64
233
+
213
234
  ## License
214
235
 
215
236
  This project is licensed under the MIT License. See the [LICENSE](LICENSE.md) file for details.
package/dist/index.mjs CHANGED
@@ -7,8 +7,8 @@ let targetFolder = "";
7
7
  function devLoad(id) {
8
8
  if (id.startsWith(resolvedIdPrefix)) {
9
9
  const query = `'/src/examples/${id.substring(id.indexOf(":") + 1)}/*.vue'`;
10
- return `export const code = import.meta.glob(${query}, { eager: true })
11
- export const source = import.meta.glob(${query}, { query: '?raw', import: 'default', eager: true })`;
10
+ return `export const code = import.meta.glob(${query})
11
+ export const source = import.meta.glob(${query}, { query: '?raw', import: 'default' })`;
12
12
  }
13
13
  return void 0;
14
14
  }
@@ -18,8 +18,8 @@ function prodLoad(id) {
18
18
  const files = globSync("*.vue", { cwd: join(targetFolder, exampleId) });
19
19
  const importList = files.map((entry) => entry.substring(0, entry.length - 4));
20
20
  const importStatements = importList.map(
21
- (entry) => `import ${entry} from 'app/src/examples/${exampleId}/${entry}.vue'
22
- import Raw${entry} from 'app/src/examples/${exampleId}/${entry}.vue?raw'`
21
+ (entry) => `import ${entry} from '@/examples/${exampleId}/${entry}.vue'
22
+ import Raw${entry} from '@/examples/${exampleId}/${entry}.vue?raw'`
23
23
  ).join("\n");
24
24
  const exportStatements = importList.map((entry) => `${entry},Raw${entry}`).join(",");
25
25
  return importStatements + `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@md-plugins/vite-examples-plugin",
3
- "version": "0.1.0-beta.2",
3
+ "version": "0.1.0-beta.21",
4
4
  "description": "A Vite plugin for @md-plugins for handling imported examples in markdown files.",
5
5
  "keywords": [
6
6
  "markdown-it",
@@ -38,10 +38,10 @@
38
38
  "access": "public"
39
39
  },
40
40
  "dependencies": {
41
- "tinyglobby": "^0.2.16"
41
+ "tinyglobby": "^0.2.17"
42
42
  },
43
43
  "devDependencies": {
44
- "vite": "^8.0.12"
44
+ "vite": "^8.0.14"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "unbuild",