@vuecast/astro-module 1.0.0 → 1.0.1
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 +88 -0
- package/dist/index.d.mts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.mjs +32 -0
- package/package.json +32 -7
- package/index.js +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# @vuecast/astro-module
|
|
2
|
+
|
|
3
|
+
Write Vue Single File Components (`.vue` files) in your Astro projects.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Use `.vue` files as pages in your Astro project
|
|
8
|
+
- Full Vue SFC support with all Vue features
|
|
9
|
+
- Seamless integration with Astro's build system
|
|
10
|
+
- Ensures proper head rendering support
|
|
11
|
+
|
|
12
|
+
## Prerequisites
|
|
13
|
+
|
|
14
|
+
First, scaffold a new Astro project:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm create astro@latest
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Install the official Astro Vue integration:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx astro add vue
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pnpm add @vuecast/astro-module
|
|
30
|
+
# or
|
|
31
|
+
npm install @vuecast/astro-module
|
|
32
|
+
# or
|
|
33
|
+
yarn add @vuecast/astro-module
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
1. Add the integration to your `astro.config.mjs`. Note that `@vuecast/astro-module` must be added after the Vue integration:
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
import { defineConfig } from "astro/config";
|
|
42
|
+
import vue from "@astrojs/vue";
|
|
43
|
+
import vuecast from "@vuecast/astro-module";
|
|
44
|
+
|
|
45
|
+
export default defineConfig({
|
|
46
|
+
integrations: [
|
|
47
|
+
vue(), // Vue integration must come first
|
|
48
|
+
vuecast(), // Then add VueCast
|
|
49
|
+
],
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
2. Create `.vue` files in your `src/pages` directory:
|
|
54
|
+
|
|
55
|
+
```vue
|
|
56
|
+
<!-- src/pages/index.vue -->
|
|
57
|
+
<script setup lang="ts">
|
|
58
|
+
const fruits = ["apples", "oranges", "bananas", "cherries", "grapes"];
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<template>
|
|
62
|
+
<div>
|
|
63
|
+
<h1>Hello from VueCast!</h1>
|
|
64
|
+
<ul>
|
|
65
|
+
<li v-for="(fruit, index) in fruits" :key="index">
|
|
66
|
+
{{ index + 1 }}: {{ fruit }}
|
|
67
|
+
</li>
|
|
68
|
+
</ul>
|
|
69
|
+
</div>
|
|
70
|
+
</template>
|
|
71
|
+
|
|
72
|
+
<style scoped>
|
|
73
|
+
/* Your component styles here */
|
|
74
|
+
</style>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## How it Works
|
|
78
|
+
|
|
79
|
+
The integration:
|
|
80
|
+
|
|
81
|
+
1. Registers `.vue` as a valid page extension in Astro
|
|
82
|
+
2. Sets up the Vue renderer for processing `.vue` files
|
|
83
|
+
3. Ensures proper head rendering support for Vue components
|
|
84
|
+
4. Integrates with Astro's build system through Vite
|
|
85
|
+
|
|
86
|
+
## License
|
|
87
|
+
|
|
88
|
+
MIT
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AstroIntegration } from 'astro';
|
|
2
|
+
|
|
3
|
+
interface VuecastAstroPluginOptions {
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
declare function vuecastAstroIntegration(options: VuecastAstroPluginOptions): AstroIntegration;
|
|
7
|
+
|
|
8
|
+
export { vuecastAstroIntegration as VuecastAstro, vuecastAstroIntegration as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AstroIntegration } from 'astro';
|
|
2
|
+
|
|
3
|
+
interface VuecastAstroPluginOptions {
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
declare function vuecastAstroIntegration(options: VuecastAstroPluginOptions): AstroIntegration;
|
|
7
|
+
|
|
8
|
+
export { vuecastAstroIntegration as VuecastAstro, vuecastAstroIntegration as default };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
function vuecastAstroIntegration(options) {
|
|
2
|
+
return {
|
|
3
|
+
name: "@vuecast/astro",
|
|
4
|
+
hooks: {
|
|
5
|
+
"astro:config:setup": async (params) => {
|
|
6
|
+
const { updateConfig, addPageExtension, addRenderer } = params;
|
|
7
|
+
addRenderer({
|
|
8
|
+
name: "vuecast:astro",
|
|
9
|
+
serverEntrypoint: "./node_modules/@astrojs/vue/dist/server.js"
|
|
10
|
+
});
|
|
11
|
+
addPageExtension(".vue");
|
|
12
|
+
updateConfig({
|
|
13
|
+
vite: {
|
|
14
|
+
plugins: [{
|
|
15
|
+
name: "vuecast-post",
|
|
16
|
+
async transform(code, id) {
|
|
17
|
+
if (!id.endsWith(".vue"))
|
|
18
|
+
return;
|
|
19
|
+
const regex = /(\]\))(;?\n?)$/;
|
|
20
|
+
const replacement = ",[Symbol.for('astro.needsHeadRendering'),true]$1";
|
|
21
|
+
code = code.replace(regex, replacement);
|
|
22
|
+
return code;
|
|
23
|
+
}
|
|
24
|
+
}]
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { vuecastAstroIntegration as VuecastAstro, vuecastAstroIntegration as default };
|
package/package.json
CHANGED
|
@@ -1,12 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuecast/astro-module",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Astro integration for Vue SFC pages",
|
|
6
|
+
"main": "./dist/index.mjs",
|
|
7
|
+
"module": "./dist/index.mjs",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.cjs",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
5
19
|
"scripts": {
|
|
6
|
-
"
|
|
20
|
+
"build": "unbuild",
|
|
21
|
+
"publish-beta": "npm run build && npm run increment-beta-version && npm publish --tag beta",
|
|
22
|
+
"increment-beta-version": "npm version prerelease --preid=beta",
|
|
23
|
+
"publish-patch": "npm run build && npm run increment-version && npm publish",
|
|
24
|
+
"increment-version": "npm version patch"
|
|
7
25
|
},
|
|
8
|
-
"keywords": [
|
|
26
|
+
"keywords": [
|
|
27
|
+
"vue",
|
|
28
|
+
"astro",
|
|
29
|
+
"sfc",
|
|
30
|
+
"meta-framework"
|
|
31
|
+
],
|
|
9
32
|
"author": "",
|
|
10
|
-
"license": "
|
|
11
|
-
"
|
|
12
|
-
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"unbuild": "^2.0.0"
|
|
36
|
+
}
|
|
37
|
+
}
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {}
|