@sveltejs/vite-plugin-svelte
Advanced tools
Comparing version 1.0.0-next.46 to 1.0.0-next.47
@@ -1,2 +0,2 @@ | ||
import { Plugin } from 'vite'; | ||
import { UserConfig, Plugin } from 'vite'; | ||
import { CompileOptions, Warning } from 'svelte/types/compiler/interfaces'; | ||
@@ -203,4 +203,6 @@ export { CompileOptions, Warning } from 'svelte/types/compiler/interfaces'; | ||
declare function loadSvelteConfig(viteConfig?: UserConfig, inlineOptions?: Partial<Options>): Promise<Partial<Options> | undefined>; | ||
declare function svelte(inlineOptions?: Partial<Options>): Plugin[]; | ||
export { Arrayable, CssHashGetter, ModuleFormat, Options, svelte }; | ||
export { Arrayable, CssHashGetter, ModuleFormat, Options, loadSvelteConfig, svelte }; |
@@ -460,5 +460,5 @@ var __defProp = Object.defineProperty; | ||
]; | ||
var dynamicImportDefault = new Function("path", 'return import(path + "?t=" + Date.now()).then(m => m.default)'); | ||
var dynamicImportDefault = new Function("path", "timestamp", 'return import(path + "?t=" + timestamp).then(m => m.default)'); | ||
async function loadSvelteConfig(viteConfig, inlineOptions) { | ||
if (inlineOptions.configFile === false) { | ||
if ((inlineOptions == null ? void 0 : inlineOptions.configFile) === false) { | ||
return; | ||
@@ -471,3 +471,3 @@ } | ||
try { | ||
const result = await dynamicImportDefault(pathToFileURL(configFile).href); | ||
const result = await dynamicImportDefault(pathToFileURL(configFile).href, fs2.statSync(configFile).mtimeMs); | ||
if (result != null) { | ||
@@ -508,4 +508,4 @@ return __spreadProps(__spreadValues({}, result), { | ||
function findConfigToLoad(viteConfig, inlineOptions) { | ||
const root = viteConfig.root || process.cwd(); | ||
if (inlineOptions.configFile) { | ||
const root = (viteConfig == null ? void 0 : viteConfig.root) || process.cwd(); | ||
if (inlineOptions == null ? void 0 : inlineOptions.configFile) { | ||
const abolutePath = path.isAbsolute(inlineOptions.configFile) ? inlineOptions.configFile : path.resolve(root, inlineOptions.configFile); | ||
@@ -1765,4 +1765,5 @@ if (!fs2.existsSync(abolutePath)) { | ||
export { | ||
loadSvelteConfig, | ||
svelte | ||
}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@sveltejs/vite-plugin-svelte", | ||
"version": "1.0.0-next.46", | ||
"version": "1.0.0-next.47", | ||
"license": "MIT", | ||
@@ -65,6 +65,6 @@ "author": "dominikg", | ||
"diff-match-patch": "^1.0.5", | ||
"esbuild": "^0.14.39", | ||
"rollup": "^2.74.1", | ||
"esbuild": "^0.14.42", | ||
"rollup": "^2.75.4", | ||
"svelte": "^3.48.0", | ||
"tsup": "^5.12.8", | ||
"tsup": "^6.0.1", | ||
"vite": "^2.9.9" | ||
@@ -74,5 +74,5 @@ }, | ||
"dev": "pnpm build:ci --sourcemap --watch src", | ||
"build:ci": "rimraf dist && tsup-node src/index.ts --format esm,cjs --no-splitting --target node14", | ||
"build:ci": "rimraf dist && tsup-node src/index.ts --format esm,cjs --no-splitting --shims", | ||
"build": "pnpm build:ci --dts --sourcemap" | ||
} | ||
} |
@@ -221,2 +221,4 @@ import fs from 'fs'; | ||
export { loadSvelteConfig } from './utils/load-svelte-config'; | ||
export { | ||
@@ -223,0 +225,0 @@ Options, |
@@ -25,10 +25,11 @@ import { createRequire } from 'module'; | ||
'path', | ||
'return import(path + "?t=" + Date.now()).then(m => m.default)' | ||
'timestamp', | ||
'return import(path + "?t=" + timestamp).then(m => m.default)' | ||
); | ||
export async function loadSvelteConfig( | ||
viteConfig: UserConfig, | ||
inlineOptions: Partial<Options> | ||
viteConfig?: UserConfig, | ||
inlineOptions?: Partial<Options> | ||
): Promise<Partial<Options> | undefined> { | ||
if (inlineOptions.configFile === false) { | ||
if (inlineOptions?.configFile === false) { | ||
return; | ||
@@ -42,3 +43,6 @@ } | ||
try { | ||
const result = await dynamicImportDefault(pathToFileURL(configFile).href); | ||
const result = await dynamicImportDefault( | ||
pathToFileURL(configFile).href, | ||
fs.statSync(configFile).mtimeMs | ||
); | ||
if (result != null) { | ||
@@ -88,5 +92,5 @@ return { | ||
function findConfigToLoad(viteConfig: UserConfig, inlineOptions: Partial<Options>) { | ||
const root = viteConfig.root || process.cwd(); | ||
if (inlineOptions.configFile) { | ||
function findConfigToLoad(viteConfig?: UserConfig, inlineOptions?: Partial<Options>) { | ||
const root = viteConfig?.root || process.cwd(); | ||
if (inlineOptions?.configFile) { | ||
const abolutePath = path.isAbsolute(inlineOptions.configFile) | ||
@@ -93,0 +97,0 @@ ? inlineOptions.configFile |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
488735
6284