@bakery-framework/plugin-vue 1.1.0 → 1.2.0

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.
Files changed (2) hide show
  1. package/package.json +3 -2
  2. package/src/index.ts +24 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bakery-framework/plugin-vue",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Bakery vue plugin.",
5
5
  "keywords": [
6
6
  "bakery",
@@ -25,7 +25,8 @@
25
25
  "main": "./src/index.ts",
26
26
  "exports": {
27
27
  ".": "./src/index.ts",
28
- "./package.json": "./package.json"
28
+ "./package.json": "./package.json",
29
+ "./vue.d.ts": "./src/vue.d.ts"
29
30
  },
30
31
  "files": [
31
32
  "src",
package/src/index.ts CHANGED
@@ -15,6 +15,30 @@ export default function vuePlugin(options?: VuePluginOptions) {
15
15
  if (options) setVuePluginOptions(options)
16
16
  return definePlugin({
17
17
  name: 'vue',
18
+
19
+ // Declarative, read by the tsconfig generator at dev boot rather than by
20
+ // the server. `.vue` needs its own project for two reasons core cannot
21
+ // cover: plain `tsc` cannot parse an SFC at all (so this is for `vue-tsc`),
22
+ // and `vue.d.ts` declares `req` and `body` for SFC scope — globals core
23
+ // deliberately does not provide. Before this, those declarations shipped in
24
+ // the package and were reachable by no app.
25
+ tsconfig: {
26
+ project: {
27
+ name: 'vue',
28
+ extends: '@bakery-framework/core/tsconfig.vue.json',
29
+ include: ['src/**/*.vue'],
30
+ // A package specifier rather than a path: the plugin does not know
31
+ // where it was installed. The generator resolves it before writing.
32
+ files: ['@bakery-framework/plugin-vue/vue.d.ts'],
33
+ // An SFC's `<script>` is browser code, so an `importMap` alias inside one
34
+ // is resolved by the browser's own import map and has to typecheck. The
35
+ // flag is off by default precisely because the *server* project must not
36
+ // have it — an alias only the browser can satisfy would typecheck there
37
+ // and fail at runtime. Vue is the case the flag exists to allow.
38
+ importMapPaths: true,
39
+ },
40
+ },
41
+
18
42
  async setup() {
19
43
  const { setupVue } = await import('./setup')
20
44
  await setupVue()