diff --git a/.changeset/odd-tables-clean.md b/.changeset/odd-tables-clean.md new file mode 100644 index 00000000..27276050 --- /dev/null +++ b/.changeset/odd-tables-clean.md @@ -0,0 +1,5 @@ +--- +"jsrepo": patch +--- + +Ensure vue compiler has `fs` access. diff --git a/examples/registry/blocks/vue/Test.vue b/examples/registry/blocks/vue/Test.vue new file mode 100644 index 00000000..a51e04c5 --- /dev/null +++ b/examples/registry/blocks/vue/Test.vue @@ -0,0 +1,11 @@ + + + \ No newline at end of file diff --git a/examples/registry/blocks/vue/type.ts b/examples/registry/blocks/vue/type.ts new file mode 100644 index 00000000..eccce919 --- /dev/null +++ b/examples/registry/blocks/vue/type.ts @@ -0,0 +1 @@ +export type PropType = { value: string }; \ No newline at end of file diff --git a/examples/registry/jsrepo-manifest.json b/examples/registry/jsrepo-manifest.json index 10d0e4e2..a00339c0 100644 --- a/examples/registry/jsrepo-manifest.json +++ b/examples/registry/jsrepo-manifest.json @@ -220,5 +220,44 @@ "devDependencies": [] } ] + }, + { + "name": "vue", + "blocks": [ + { + "name": "Test", + "directory": "blocks/vue", + "category": "vue", + "tests": false, + "subdirectory": false, + "list": true, + "files": [ + "Test.vue" + ], + "localDependencies": [ + "vue/type" + ], + "_imports_": { + "./type": "{{vue/type}}" + }, + "dependencies": [], + "devDependencies": [] + }, + { + "name": "type", + "directory": "blocks/vue", + "category": "vue", + "tests": false, + "subdirectory": false, + "list": true, + "files": [ + "type.ts" + ], + "localDependencies": [], + "_imports_": {}, + "dependencies": [], + "devDependencies": [] + } + ] } ] \ No newline at end of file diff --git a/packages/cli/package.json b/packages/cli/package.json index 46ebf18c..b16063e0 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -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", diff --git a/packages/cli/src/utils/language-support.ts b/packages/cli/src/utils/language-support.ts index ca4abc41..1887b3f6 100644 --- a/packages/cli/src/utils/language-support.ts +++ b/packages/cli/src/utils/language-support.ts @@ -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}`); }