vite-plugin-elm
Advanced tools
Comparing version 3.0.0 to 3.0.1
import type { Plugin } from 'vite'; | ||
type NodeElmCompilerOptions = { | ||
cwd?: string; | ||
docs?: string; | ||
debug?: boolean; | ||
optimize?: boolean; | ||
processOpts?: Record<string, string>; | ||
report?: string; | ||
pathToElm?: string; | ||
verbose?: boolean; | ||
}; | ||
export declare const plugin: (opts?: { | ||
debug?: boolean; | ||
optimize?: boolean; | ||
nodeElmCompilerOptions: NodeElmCompilerOptions; | ||
}) => Plugin; | ||
import { parseOptions } from './pluginOptions.js'; | ||
export declare const plugin: (userOptions?: Parameters<typeof parseOptions>[0]) => Plugin; | ||
export default plugin; |
@@ -11,2 +11,3 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ | ||
import { acquireLock } from './mutex.js'; | ||
import { parseOptions } from './pluginOptions.js'; | ||
/* eslint-enable @typescript-eslint/ban-ts-comment */ | ||
@@ -30,7 +31,5 @@ const trimDebugMessage = (code) => code.replace(/(console\.warn\('Compiled in DEBUG mode)/, '// $1'); | ||
}; | ||
export const plugin = (opts) => { | ||
export const plugin = (userOptions = {}) => { | ||
const options = parseOptions(userOptions); | ||
const compilableFiles = new Map(); | ||
const debug = opts?.debug; | ||
const optimize = opts?.optimize; | ||
const compilerOptionsOverwrite = opts?.nodeElmCompilerOptions ?? {}; | ||
return { | ||
@@ -76,4 +75,4 @@ name: 'vite-plugin-elm', | ||
} | ||
const resolveAcoompany = async (accompany) => (await this.resolve(accompany, importer))?.id ?? ''; | ||
return Promise.all(withParams.map(resolveAcoompany)); | ||
const resolveAccompany = async (accompany) => (await this.resolve(accompany, importer))?.id ?? ''; | ||
return Promise.all(withParams.map(resolveAccompany)); | ||
} | ||
@@ -90,10 +89,9 @@ else { | ||
try { | ||
const isBuild = process.env.NODE_ENV === 'production'; | ||
const compiled = await compiler.compileToString(targets, { | ||
output: '.js', | ||
optimize: typeof optimize === 'boolean' ? optimize : !debug && isBuild, | ||
verbose: isBuild, | ||
debug: debug ?? !isBuild, | ||
optimize: options.optimize, | ||
verbose: options.isBuild, | ||
debug: options.debug, | ||
cwd: await findClosestElmJson(pathname), | ||
...compilerOptionsOverwrite, | ||
...options.nodeElmCompilerOptionsOverwrite, | ||
}); | ||
@@ -106,3 +104,3 @@ const esm = injectAssets(toESModule(compiled)); | ||
return { | ||
code: isBuild ? esm : trimDebugMessage(injectHMR(esm, dependencies.map(viteProjectPath))), | ||
code: options.isBuild ? esm : trimDebugMessage(injectHMR(esm, dependencies.map(viteProjectPath))), | ||
map: null, | ||
@@ -109,0 +107,0 @@ }; |
{ | ||
"name": "vite-plugin-elm", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Compile Elm with vite", | ||
@@ -17,2 +17,4 @@ "exports": "./dist/index.js", | ||
"build:example": "cd ./example && npm i && npm run build", | ||
"test": "vitest", | ||
"test:ci": "vitest run", | ||
"test-server:dev": "cd ./example && npm run dev -- --port 8936", | ||
@@ -65,12 +67,12 @@ "test-server:preview": "cd ./example && npm run preview -- --port 8938", | ||
"devDependencies": { | ||
"@types/node": "18.19.7", | ||
"@typescript-eslint/eslint-plugin": "6.20.0", | ||
"@typescript-eslint/parser": "6.20.0", | ||
"cypress": "13.6.3", | ||
"eslint": "8.56.0", | ||
"@types/node": "18.19.31", | ||
"cypress": "13.7.3", | ||
"eslint": "8.57.0", | ||
"eslint-config-prettier": "9.1.0", | ||
"npm-run-all": "4.1.5", | ||
"prettier": "3.2.4", | ||
"typescript": "5.3.3", | ||
"vite": "5.0.12" | ||
"prettier": "3.2.5", | ||
"typescript": "5.4.5", | ||
"typescript-eslint": "^7.0.2", | ||
"vite": "5.2.8", | ||
"vitest": "1.5.0" | ||
}, | ||
@@ -77,0 +79,0 @@ "peerDependencies": { |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
47907
21
646
0