Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sveltejs/vite-plugin-svelte

Package Overview
Dependencies
Maintainers
4
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sveltejs/vite-plugin-svelte - npm Package Compare versions

Comparing version 1.0.0-next.31 to 1.0.0-next.32

26

dist/index.js

@@ -893,3 +893,4 @@ var __defProp = Object.defineProperty;

isBuild: viteEnv.command === "build",
isServe: viteEnv.command === "serve"
isServe: viteEnv.command === "serve",
isSvelteKit: !!(svelteConfig == null ? void 0 : svelteConfig.kit)
});

@@ -1076,3 +1077,3 @@ if (svelteConfig == null ? void 0 : svelteConfig.configFile) {

const { watcher, ws } = server;
const { configFile: viteConfigFile, root, server: serverConfig } = server.config;
const { root, server: serverConfig } = server.config;
const emitChangeEventOnDependants = (filename) => {

@@ -1097,6 +1098,4 @@ const dependants = cache.getDependants(filename);

const triggerViteRestart = (filename) => {
if (!!viteConfigFile && !serverConfig.middlewareMode) {
log.info(`svelte config changed: restarting vite server. - file: ${filename}`);
watcher.emit("change", viteConfigFile);
} else {
var _a;
if (serverConfig.middlewareMode || options.isSvelteKit) {
const message = "Svelte config change detected, restart your dev process to apply the changes.";

@@ -1108,2 +1107,5 @@ log.info(message, filename);

});
} else {
log.info(`svelte config changed: restarting vite server. - file: ${filename}`);
server.restart(!!((_a = options.experimental) == null ? void 0 : _a.prebundleSvelteLibraries));
}

@@ -1159,3 +1161,3 @@ };

function isBareImport(importee) {
if (!importee || importee[0] === "." || importee[0] === "\0" || path5.isAbsolute(importee)) {
if (!importee || importee[0] === "." || importee[0] === "\0" || importee.includes(":") || path5.isAbsolute(importee)) {
return false;

@@ -1459,5 +1461,5 @@ }

},
async resolveId(importee, importer, opts, _ssr) {
const ssr = _ssr === true || opts.ssr;
const svelteRequest = requestParser(importee, !!ssr);
async resolveId(importee, importer, opts) {
const ssr = !!(opts == null ? void 0 : opts.ssr);
const svelteRequest = requestParser(importee, ssr);
if (svelteRequest == null ? void 0 : svelteRequest.query.svelte) {

@@ -1503,4 +1505,4 @@ if (svelteRequest.query.type === "style") {

var _a;
const ssr = opts === true || (opts == null ? void 0 : opts.ssr);
const svelteRequest = requestParser(id, !!ssr);
const ssr = !!(opts == null ? void 0 : opts.ssr);
const svelteRequest = requestParser(id, ssr);
if (!svelteRequest) {

@@ -1507,0 +1509,0 @@ return;

{
"name": "@sveltejs/vite-plugin-svelte",
"version": "1.0.0-next.31",
"version": "1.0.0-next.32",
"license": "MIT",

@@ -53,3 +53,3 @@ "author": "dominikg",

"svelte": "^3.44.0",
"vite": "^2.6.0"
"vite": "^2.7.0"
},

@@ -69,3 +69,3 @@ "peerDependenciesMeta": {

"tsup": "^5.10.1",
"vite": "^2.6.14"
"vite": "^2.7.0"
},

@@ -72,0 +72,0 @@ "scripts": {

@@ -98,7 +98,5 @@ import fs from 'fs';

async resolveId(importee, importer, opts, _ssr) {
// @ts-expect-error anticipate vite deprecating forth parameter and rely on `opts.ssr` instead`
// see https://github.com/vitejs/vite/discussions/5109
const ssr: boolean = _ssr === true || opts.ssr;
const svelteRequest = requestParser(importee, !!ssr);
async resolveId(importee, importer, opts) {
const ssr = !!opts?.ssr;
const svelteRequest = requestParser(importee, ssr);
if (svelteRequest?.query.svelte) {

@@ -154,6 +152,4 @@ if (svelteRequest.query.type === 'style') {

async transform(code, id, opts) {
// @ts-expect-error anticipate vite changing third parameter as options object
// see https://github.com/vitejs/vite/discussions/5109
const ssr: boolean = opts === true || opts?.ssr;
const svelteRequest = requestParser(id, !!ssr);
const ssr = !!opts?.ssr;
const svelteRequest = requestParser(id, ssr);
if (!svelteRequest) {

@@ -160,0 +156,0 @@ return;

@@ -124,2 +124,3 @@ /* eslint-disable no-unused-vars */

): ResolvedOptions {
// @ts-ignore
const merged = {

@@ -141,3 +142,5 @@ ...defaultOptions,

isBuild: viteEnv.command === 'build',
isServe: viteEnv.command === 'serve'
isServe: viteEnv.command === 'serve',
// @ts-expect-error we don't declare kit property of svelte config but read it once here to identify kit projects
isSvelteKit: !!svelteConfig?.kit
};

@@ -490,2 +493,3 @@ // configFile of svelteConfig contains the absolute path it was loaded from,

server?: ViteDevServer;
isSvelteKit?: boolean;
}

@@ -492,0 +496,0 @@

@@ -17,3 +17,9 @@ import path from 'path';

function isBareImport(importee: string): boolean {
if (!importee || importee[0] === '.' || importee[0] === '\0' || path.isAbsolute(importee)) {
if (
!importee ||
importee[0] === '.' ||
importee[0] === '\0' ||
importee.includes(':') ||
path.isAbsolute(importee)
) {
return false;

@@ -20,0 +26,0 @@ }

@@ -20,3 +20,3 @@ import { VitePluginSvelteCache } from './vite-plugin-svelte-cache';

const { watcher, ws } = server;
const { configFile: viteConfigFile, root, server: serverConfig } = server.config;
const { root, server: serverConfig } = server.config;

@@ -46,8 +46,5 @@ const emitChangeEventOnDependants = (filename: string) => {

const triggerViteRestart = (filename: string) => {
// vite restart is triggered by simulating a change to vite config. This requires that vite config exists
// also we do not restart in middleware-mode as it could be risky
if (!!viteConfigFile && !serverConfig.middlewareMode) {
log.info(`svelte config changed: restarting vite server. - file: ${filename}`);
watcher.emit('change', viteConfigFile);
} else {
if (serverConfig.middlewareMode || options.isSvelteKit) {
// in middlewareMode or for sveltekit we can't restart the server automatically
// show the user an overlay instead
const message =

@@ -60,2 +57,5 @@ 'Svelte config change detected, restart your dev process to apply the changes.';

});
} else {
log.info(`svelte config changed: restarting vite server. - file: ${filename}`);
server.restart(!!options.experimental?.prebundleSvelteLibraries);
}

@@ -62,0 +62,0 @@ };

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc