@rollup/plugin-dynamic-import-vars
Advanced tools
Comparing version 2.0.7 to 2.1.0
@@ -135,3 +135,3 @@ 'use strict'; | ||
function dynamicImportVariables({ include, exclude, warnOnError } = {}) { | ||
function dynamicImportVariables({ include, exclude, warnOnError, errorWhenNoFilesFound } = {}) { | ||
const filter = pluginutils.createFilter(include, exclude); | ||
@@ -182,2 +182,10 @@ | ||
if (errorWhenNoFilesFound && paths.length === 0) { | ||
this.error( | ||
new Error( | ||
`No files found in ${glob} when trying to dynamically load concatted string from ${id}` | ||
) | ||
); | ||
} | ||
// create magic string if it wasn't created already | ||
@@ -184,0 +192,0 @@ ms = ms || new MagicString(code); |
@@ -131,3 +131,3 @@ import path from 'path'; | ||
function dynamicImportVariables({ include, exclude, warnOnError } = {}) { | ||
function dynamicImportVariables({ include, exclude, warnOnError, errorWhenNoFilesFound } = {}) { | ||
const filter = createFilter(include, exclude); | ||
@@ -178,2 +178,10 @@ | ||
if (errorWhenNoFilesFound && paths.length === 0) { | ||
this.error( | ||
new Error( | ||
`No files found in ${glob} when trying to dynamically load concatted string from ${id}` | ||
) | ||
); | ||
} | ||
// create magic string if it wasn't created already | ||
@@ -180,0 +188,0 @@ ms = ms || new MagicString(code); |
{ | ||
"name": "@rollup/plugin-dynamic-import-vars", | ||
"version": "2.0.7", | ||
"version": "2.1.0", | ||
"publishConfig": { | ||
@@ -26,15 +26,2 @@ "access": "public" | ||
}, | ||
"scripts": { | ||
"build": "rollup -c", | ||
"ci:coverage": "nyc pnpm test && nyc report --reporter=text-lcov > coverage.lcov", | ||
"ci:lint": "pnpm build && pnpm lint", | ||
"ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}", | ||
"ci:test": "pnpm test -- --verbose", | ||
"prebuild": "del-cli dist", | ||
"prepare": "if [ ! -d 'dist' ]; then pnpm build; fi", | ||
"prerelease": "pnpm build", | ||
"pretest": "pnpm build --sourcemap", | ||
"release": "pnpm --workspace-root plugin:release --pkg $npm_package_name", | ||
"test": "ava" | ||
}, | ||
"files": [ | ||
@@ -85,3 +72,15 @@ "dist", | ||
] | ||
}, | ||
"scripts": { | ||
"build": "rollup -c", | ||
"ci:coverage": "nyc pnpm test && nyc report --reporter=text-lcov > coverage.lcov", | ||
"ci:lint": "pnpm build && pnpm lint", | ||
"ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}", | ||
"ci:test": "pnpm test -- --verbose", | ||
"prebuild": "del-cli dist", | ||
"prerelease": "pnpm build", | ||
"pretest": "pnpm build --sourcemap", | ||
"release": "pnpm --workspace-root package:release $(pwd)", | ||
"test": "ava" | ||
} | ||
} | ||
} |
@@ -64,2 +64,9 @@ [npm]: https://img.shields.io/npm/v/@rollup/plugin-dynamic-import-vars | ||
#### `errorWhenNoFilesFound` | ||
Type: `Boolean`<br> | ||
Default: `false` | ||
By default, the plugin will not throw errors when target files are not found. Setting this option to true will result in errors thrown when encountering files which don't exist. | ||
#### `warnOnError` | ||
@@ -66,0 +73,0 @@ |
@@ -19,2 +19,8 @@ import type { FilterPattern } from '@rollup/pluginutils'; | ||
/** | ||
* By default, the plugin will not throw errors when target files are not found. | ||
* Setting this option to true will result in errors thrown when encountering files which don't exist. | ||
* @default false | ||
*/ | ||
errorWhenNoFilesFound?: boolean; | ||
/** | ||
* By default, the plugin quits the build process when it encounters an error. | ||
@@ -21,0 +27,0 @@ * If you set this option to true, it will throw a warning instead and leave the code untouched. |
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
33353
8
653
231