@modyfi/vite-plugin-yaml
Advanced tools
Comparing version 1.0.4 to 1.1.0
@@ -27,2 +27,8 @@ import { Schema, YAMLException } from 'js-yaml'; | ||
/** | ||
* A boolean to determine if JSON object should be serialized. | ||
* | ||
* @see https://www.npmjs.com/package/tosource for the motivation behind serialization of JSON. | ||
*/ | ||
raw?: boolean; | ||
/** | ||
* A function that will be called for error reporting. | ||
@@ -39,2 +45,2 @@ * | ||
export { PluginOptions, _default as default }; | ||
export { type PluginOptions, _default as default }; |
@@ -20,3 +20,3 @@ // src/index.ts | ||
return { | ||
code: `const data = ${toSource(yamlData)}; | ||
code: `const data = ${options.raw ? yamlData : toSource(yamlData)}; | ||
export default data;`, | ||
@@ -23,0 +23,0 @@ map: { mappings: "" } |
{ | ||
"name": "@modyfi/vite-plugin-yaml", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"description": "Import YAML files as JS objects 🔌", | ||
@@ -12,2 +12,8 @@ "type": "module", | ||
"license": "MIT", | ||
"scripts": { | ||
"dev": "tsup --watch src", | ||
"example:dev": "pnpm -C example run dev", | ||
"example:build": "pnpm run build && pnpm -C example run build", | ||
"build": "tsup" | ||
}, | ||
"exports": { | ||
@@ -46,6 +52,6 @@ ".": { | ||
"peerDependencies": { | ||
"vite": "^2.6.0 || ^3.0.0 || ^4.0.0" | ||
"vite": "^3.2.7 || ^4.0.5 || ^5.0.5" | ||
}, | ||
"dependencies": { | ||
"@rollup/pluginutils": "5.0.2", | ||
"@rollup/pluginutils": "5.1.0", | ||
"js-yaml": "4.1.0", | ||
@@ -55,14 +61,8 @@ "tosource": "2.0.0-alpha.3" | ||
"devDependencies": { | ||
"@types/js-yaml": "4.0.5", | ||
"c8": "7.12.0", | ||
"tsup": "6.5.0", | ||
"typescript": "4.9.4", | ||
"vite": "4.0.3" | ||
}, | ||
"scripts": { | ||
"dev": "tsup --watch src", | ||
"example:dev": "pnpm -C example run dev", | ||
"example:build": "pnpm run build && pnpm -C example run build", | ||
"build": "tsup" | ||
"@types/js-yaml": "4.0.9", | ||
"c8": "8.0.1", | ||
"tsup": "8.0.1", | ||
"typescript": "5.3.3", | ||
"vite": "5.0.10" | ||
} | ||
} | ||
} |
@@ -32,2 +32,12 @@ [![Pipeline](https://github.com/Modyfi/vite-plugin-yaml/actions/workflows/pipeline.yml/badge.svg)](https://github.com/Modyfi/vite-plugin-yaml/actions/workflows/pipeline.yml) | ||
Then you can simply import yaml files like you would any other file: | ||
```ts | ||
import YamlContent from './your.yaml'; | ||
console.log(YamlContent.example); | ||
``` | ||
Do note that you may have to include the file type in your import. | ||
### 🔦 TypeScript support | ||
@@ -79,2 +89,8 @@ | ||
/** | ||
* A boolean to determine if JSON object should be serialized. | ||
* | ||
* @see https://www.npmjs.com/package/tosource for the motivation behind serialization of JSON. | ||
*/ | ||
raw?: boolean; | ||
/** | ||
* A function that will be called for error reporting. | ||
@@ -81,0 +97,0 @@ * |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8788
7
107
100
+ Added@esbuild/aix-ppc64@0.21.5(transitive)
+ Added@esbuild/android-arm@0.21.5(transitive)
+ Added@esbuild/android-arm64@0.21.5(transitive)
+ Added@esbuild/android-x64@0.21.5(transitive)
+ Added@esbuild/darwin-arm64@0.21.5(transitive)
+ Added@esbuild/darwin-x64@0.21.5(transitive)
+ Added@esbuild/freebsd-arm64@0.21.5(transitive)
+ Added@esbuild/freebsd-x64@0.21.5(transitive)
+ Added@esbuild/linux-arm@0.21.5(transitive)
+ Added@esbuild/linux-arm64@0.21.5(transitive)
+ Added@esbuild/linux-ia32@0.21.5(transitive)
+ Added@esbuild/linux-loong64@0.21.5(transitive)
+ Added@esbuild/linux-mips64el@0.21.5(transitive)
+ Added@esbuild/linux-ppc64@0.21.5(transitive)
+ Added@esbuild/linux-riscv64@0.21.5(transitive)
+ Added@esbuild/linux-s390x@0.21.5(transitive)
+ Added@esbuild/linux-x64@0.21.5(transitive)
+ Added@esbuild/netbsd-x64@0.21.5(transitive)
+ Added@esbuild/openbsd-x64@0.21.5(transitive)
+ Added@esbuild/sunos-x64@0.21.5(transitive)
+ Added@esbuild/win32-arm64@0.21.5(transitive)
+ Added@esbuild/win32-ia32@0.21.5(transitive)
+ Added@esbuild/win32-x64@0.21.5(transitive)
+ Added@rollup/pluginutils@5.1.0(transitive)
+ Added@rollup/rollup-android-arm-eabi@4.29.2(transitive)
+ Added@rollup/rollup-android-arm64@4.29.2(transitive)
+ Added@rollup/rollup-darwin-arm64@4.29.2(transitive)
+ Added@rollup/rollup-darwin-x64@4.29.2(transitive)
+ Added@rollup/rollup-freebsd-arm64@4.29.2(transitive)
+ Added@rollup/rollup-freebsd-x64@4.29.2(transitive)
+ Added@rollup/rollup-linux-arm-gnueabihf@4.29.2(transitive)
+ Added@rollup/rollup-linux-arm-musleabihf@4.29.2(transitive)
+ Added@rollup/rollup-linux-arm64-gnu@4.29.2(transitive)
+ Added@rollup/rollup-linux-arm64-musl@4.29.2(transitive)
+ Added@rollup/rollup-linux-loongarch64-gnu@4.29.2(transitive)
+ Added@rollup/rollup-linux-powerpc64le-gnu@4.29.2(transitive)
+ Added@rollup/rollup-linux-riscv64-gnu@4.29.2(transitive)
+ Added@rollup/rollup-linux-s390x-gnu@4.29.2(transitive)
+ Added@rollup/rollup-linux-x64-gnu@4.29.2(transitive)
+ Added@rollup/rollup-linux-x64-musl@4.29.2(transitive)
+ Added@rollup/rollup-win32-arm64-msvc@4.29.2(transitive)
+ Added@rollup/rollup-win32-ia32-msvc@4.29.2(transitive)
+ Added@rollup/rollup-win32-x64-msvc@4.29.2(transitive)
+ Addedesbuild@0.21.5(transitive)
+ Addedrollup@4.29.2(transitive)
+ Addedvite@5.4.11(transitive)
- Removed@esbuild/android-arm@0.18.20(transitive)
- Removed@esbuild/android-arm64@0.18.20(transitive)
- Removed@esbuild/android-x64@0.18.20(transitive)
- Removed@esbuild/darwin-arm64@0.18.20(transitive)
- Removed@esbuild/darwin-x64@0.18.20(transitive)
- Removed@esbuild/freebsd-arm64@0.18.20(transitive)
- Removed@esbuild/freebsd-x64@0.18.20(transitive)
- Removed@esbuild/linux-arm@0.18.20(transitive)
- Removed@esbuild/linux-arm64@0.18.20(transitive)
- Removed@esbuild/linux-ia32@0.18.20(transitive)
- Removed@esbuild/linux-loong64@0.18.20(transitive)
- Removed@esbuild/linux-mips64el@0.18.20(transitive)
- Removed@esbuild/linux-ppc64@0.18.20(transitive)
- Removed@esbuild/linux-riscv64@0.18.20(transitive)
- Removed@esbuild/linux-s390x@0.18.20(transitive)
- Removed@esbuild/linux-x64@0.18.20(transitive)
- Removed@esbuild/netbsd-x64@0.18.20(transitive)
- Removed@esbuild/openbsd-x64@0.18.20(transitive)
- Removed@esbuild/sunos-x64@0.18.20(transitive)
- Removed@esbuild/win32-arm64@0.18.20(transitive)
- Removed@esbuild/win32-ia32@0.18.20(transitive)
- Removed@esbuild/win32-x64@0.18.20(transitive)
- Removed@rollup/pluginutils@5.0.2(transitive)
- Removedesbuild@0.18.20(transitive)
- Removedrollup@3.29.5(transitive)
- Removedvite@4.5.5(transitive)
Updated@rollup/pluginutils@5.1.0