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

svelte-loader

Package Overview
Dependencies
Maintainers
2
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-loader - npm Package Compare versions

Comparing version 2.5.1 to 2.6.0

4

CHANGELOG.md
# svelte-loader changelog
## 2.6.0
* Prevent future post-1.60 deprecation warnings ([#48](https://github.com/sveltejs/svelte-loader/pull/48))
## 2.5.1

@@ -4,0 +8,0 @@

27

index.js

@@ -51,2 +51,15 @@ const { basename, extname, posix, relative } = require('path');

function normalize(compiled) {
// svelte.compile signature changed in 1.60 — this avoids
// future deprecation warnings while preserving backwards
// compatibility
const js = compiled.js || { code: compiled.code, map: compiled.map };
const css = compiled.css && typeof compiled.css === 'object'
? compiled.css
: { code: compiled.css, map: compiled.cssMap };
return { js, css, ast: compiled.ast };
}
module.exports = function(source, map) {

@@ -76,12 +89,12 @@ this.cacheable();

preprocess(source, options).then(processed => {
let { code, map, css, cssMap, ast } = compile(processed.toString(), options);
let { js, css, ast } = normalize(compile(processed.toString(), options));
if (options.emitCss && css) {
if (options.emitCss && css.code) {
const posixTmpdir = posixify(tmpdir());
const tmpFile = posix.join(posixTmpdir, 'svelte-' + ast.hash + '.css');
css += '\n/*# sourceMappingURL=' + cssMap.toUrl() + '*/';
code = code + `\nrequire('${tmpFile}');\n`;
css.code += '\n/*# sourceMappingURL=' + css.map.toUrl() + '*/';
js.code = js.code + `\nrequire('${tmpFile}');\n`;
writeFileSync(tmpFile, css);
writeFileSync(tmpFile, css.code);
const { atime, mtime } = statSync(tmpFile);

@@ -94,6 +107,6 @@ utimesSync(tmpFile, new Date(atime.getTime() - 99999), new Date(mtime.getTime() - 99999));

const id = JSON.stringify(relative(process.cwd(), options.filename));
code = makeHot(id, code, hotOptions);
js.code = makeHot(id, js.code, hotOptions);
}
callback(null, code, map);
callback(null, js.code, js.map);
}, err => callback(err)).catch(err => {

@@ -100,0 +113,0 @@ // wrap error to provide correct

{
"name": "svelte-loader",
"version": "2.5.1",
"version": "2.6.0",
"author": "Nico Rehwaldt <git_nikku@nixis.de>",

@@ -29,3 +29,3 @@ "description": "A webpack loader for svelte",

"sinon-chai": "^2.8.0",
"svelte": "^1.56.0"
"svelte": "^1.60.0"
},

@@ -32,0 +32,0 @@ "peerDependencies": {

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