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.26 to 1.0.0-next.27

40

dist/index.js

@@ -1055,2 +1055,3 @@ var __create = Object.create;

import MagicString2 from "magic-string";
import { preprocess as preprocess2 } from "svelte/compiler";

@@ -1154,4 +1155,8 @@ // src/utils/sourcemap.ts

return {
script: createViteScriptPreprocessor(),
style: createViteStylePreprocessor(config)
markup({ content, filename }) {
return preprocess2(content, {
script: createViteScriptPreprocessor(),
style: createViteStylePreprocessor(config)
}, { filename });
}
};

@@ -1173,6 +1178,7 @@ }

var _a, _b;
const extraPreprocessors = [];
const prependPreprocessors = [];
const appendPreprocessors = [];
if ((_a = options.experimental) == null ? void 0 : _a.useVitePreprocess) {
log.debug("adding vite preprocessor");
extraPreprocessors.push(createVitePreprocessorGroup(config));
prependPreprocessors.push(createVitePreprocessorGroup(config));
}

@@ -1210,19 +1216,20 @@ const pluginsWithPreprocessorsDeprecated = config.plugins.filter((p) => p == null ? void 0 : p.sveltePreprocess);

log.debug(`Adding svelte preprocessors defined by these vite plugins: ${included.map((p) => p.name).join(", ")}`);
extraPreprocessors.push(...pluginsWithPreprocessors.map((p) => p.api.sveltePreprocess));
appendPreprocessors.push(...pluginsWithPreprocessors.map((p) => p.api.sveltePreprocess));
}
if (options.hot && options.emitCss) {
extraPreprocessors.push(createInjectScopeEverythingRulePreprocessorGroup());
appendPreprocessors.push(createInjectScopeEverythingRulePreprocessorGroup());
}
return extraPreprocessors;
return { prependPreprocessors, appendPreprocessors };
}
function addExtraPreprocessors(options, config) {
var _a;
const extra = buildExtraPreprocessors(options, config);
if ((extra == null ? void 0 : extra.length) > 0) {
const { prependPreprocessors, appendPreprocessors } = buildExtraPreprocessors(options, config);
if (prependPreprocessors.length > 0 || appendPreprocessors.length > 0) {
if (!options.preprocess) {
options.preprocess = extra;
options.preprocess = [...prependPreprocessors, ...appendPreprocessors];
} else if (Array.isArray(options.preprocess)) {
options.preprocess.push(...extra);
options.preprocess.unshift(...prependPreprocessors);
options.preprocess.push(...appendPreprocessors);
} else {
options.preprocess = [options.preprocess, ...extra];
options.preprocess = [...prependPreprocessors, options.preprocess, ...appendPreprocessors];
}

@@ -1314,3 +1321,4 @@ }

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

@@ -1332,3 +1340,4 @@ if (svelteRequest) {

},
async resolveId(importee, importer, customOptions, ssr) {
async resolveId(importee, importer, opts, _ssr) {
const ssr = _ssr === true || opts.ssr;
const svelteRequest = requestParser(importee, !!ssr);

@@ -1373,4 +1382,5 @@ if (svelteRequest == null ? void 0 : svelteRequest.query.svelte) {

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

@@ -1377,0 +1387,0 @@ if (!svelteRequest) {

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

@@ -64,7 +64,7 @@ "author": "dominikg",

"diff-match-patch": "^1.0.5",
"esbuild": "^0.13.3",
"rollup": "^2.57.0",
"svelte": "^3.43.0",
"tsup": "^5.2.1",
"vite": "^2.6.0"
"esbuild": "^0.13.4",
"rollup": "^2.58.0",
"svelte": "^3.43.1",
"tsup": "^5.4.0",
"vite": "^2.6.5"
},

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

@@ -74,3 +74,6 @@ import fs from 'fs';

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

@@ -95,3 +98,6 @@ if (svelteRequest) {

async resolveId(importee, importer, customOptions, ssr) {
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);

@@ -147,3 +153,6 @@ if (svelteRequest?.query.svelte) {

async transform(code, id, ssr) {
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);

@@ -150,0 +159,0 @@ if (!svelteRequest) {

@@ -9,2 +9,3 @@ import {

import MagicString from 'magic-string';
import { preprocess } from 'svelte/compiler';
import { Preprocessor, PreprocessorGroup, Processed, ResolvedOptions } from './options';

@@ -74,4 +75,12 @@ import { TransformPluginContext } from 'rollup';

return {
script: createViteScriptPreprocessor(),
style: createViteStylePreprocessor(config)
markup({ content, filename }) {
return preprocess(
content,
{
script: createViteScriptPreprocessor(),
style: createViteStylePreprocessor(config)
},
{ filename }
);
}
} as PreprocessorGroup;

@@ -100,6 +109,8 @@ }

function buildExtraPreprocessors(options: ResolvedOptions, config: ResolvedConfig) {
const extraPreprocessors = [];
const prependPreprocessors: PreprocessorGroup[] = [];
const appendPreprocessors: PreprocessorGroup[] = [];
if (options.experimental?.useVitePreprocess) {
log.debug('adding vite preprocessor');
extraPreprocessors.push(createVitePreprocessorGroup(config));
prependPreprocessors.push(createVitePreprocessorGroup(config));
}

@@ -158,21 +169,22 @@

);
extraPreprocessors.push(...pluginsWithPreprocessors.map((p) => p.api.sveltePreprocess));
appendPreprocessors.push(...pluginsWithPreprocessors.map((p) => p.api.sveltePreprocess));
}
if (options.hot && options.emitCss) {
extraPreprocessors.push(createInjectScopeEverythingRulePreprocessorGroup());
appendPreprocessors.push(createInjectScopeEverythingRulePreprocessorGroup());
}
return extraPreprocessors;
return { prependPreprocessors, appendPreprocessors };
}
export function addExtraPreprocessors(options: ResolvedOptions, config: ResolvedConfig) {
const extra = buildExtraPreprocessors(options, config);
if (extra?.length > 0) {
const { prependPreprocessors, appendPreprocessors } = buildExtraPreprocessors(options, config);
if (prependPreprocessors.length > 0 || appendPreprocessors.length > 0) {
if (!options.preprocess) {
options.preprocess = extra;
options.preprocess = [...prependPreprocessors, ...appendPreprocessors];
} else if (Array.isArray(options.preprocess)) {
options.preprocess.push(...extra);
options.preprocess.unshift(...prependPreprocessors);
options.preprocess.push(...appendPreprocessors);
} else {
options.preprocess = [options.preprocess, ...extra];
options.preprocess = [...prependPreprocessors, options.preprocess, ...appendPreprocessors];
}

@@ -179,0 +191,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