Skip to content

Commit

Permalink
fixes #332
Browse files Browse the repository at this point in the history
  • Loading branch information
ieedan committed Jan 6, 2025
1 parent 689306c commit f3ecf0d
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 239 deletions.
5 changes: 5 additions & 0 deletions .changeset/odd-tables-clean.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"jsrepo": patch
---

Ensure vue compiler has `fs` access.
11 changes: 11 additions & 0 deletions examples/registry/blocks/vue/Test.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script setup lang="ts">
import type { PropType } from './type';
const props = defineProps<PropType>();
</script>

<template>
<div>
{{ value }}
</div>
</template>
1 change: 1 addition & 0 deletions examples/registry/blocks/vue/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type PropType = { value: string };
224 changes: 0 additions & 224 deletions examples/registry/jsrepo-manifest.json

This file was deleted.

16 changes: 2 additions & 14 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,12 @@
"bugs": {
"url": "https://github.com/ieedan/jsrepo/issues"
},
"keywords": [
"repo",
"cli",
"svelte",
"vue",
"typescript",
"javascript",
"shadcn",
"registry"
],
"keywords": ["repo", "cli", "svelte", "vue", "typescript", "javascript", "shadcn", "registry"],
"type": "module",
"exports": "./dist/index.js",
"bin": "./dist/index.js",
"main": "./dist/index.js",
"files": [
"./schemas/**/*",
"dist"
],
"files": ["./schemas/**/*", "dist"],
"scripts": {
"start": "tsup --silent && node ./dist/index.js",
"build": "tsup",
Expand Down
9 changes: 8 additions & 1 deletion packages/cli/src/utils/language-support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,14 @@ const vue: Lang = {

let compiled: v.SFCScriptBlock;
try {
compiled = v.compileScript(parsed.descriptor, { id: 'shut-it' }); // you need this id to remove a warning
compiled = v.compileScript(parsed.descriptor, {
id: 'shut-it',
fs: {
fileExists: fs.existsSync,
readFile: (file) => fs.readFileSync(file).toString(),
realpath: fs.realpathSync,
},
}); // you need this id to remove a warning
} catch (err) {
return Err(`Compile error: ${err}`);
}
Expand Down

0 comments on commit f3ecf0d

Please sign in to comment.