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.2.1 to 2.2.2

4

CHANGELOG.md
# svelte-loader changelog
## 2.2.2
* Deterministic filenames for CSS output ([#30](https://github.com/sveltejs/svelte-loader/pull/30))
## 2.2.1

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

19

index.js

@@ -1,6 +0,6 @@

const { basename, extname } = require('path');
const { basename, extname, join } = require('path');
const { compile } = require('svelte');
const { getOptions } = require('loader-utils');
const { statSync, utimesSync, writeFileSync } = require('fs');
const { fileSync } = require('tmp');
const { tmpdir } = require('os');

@@ -35,12 +35,13 @@ function sanitize(input) {

try {
let { code, map, css, cssMap } = compile(source, options);
let { code, map, css, cssMap, ast } = compile(source, options);
if (options.emitCss && css) {
const tmpobj = fileSync({ postfix: '.css' });
const tmpFile = join(tmpdir(), 'svelte-' + ast.hash + '.css');
css += '\n/*# sourceMappingURL=' + cssMap.toUrl() + '*/';
code = code + `\nrequire('${tmpobj.name}');\n`;
code = code + `\nrequire('${tmpFile}');\n`;
writeFileSync(tmpobj.name, css);
const stats = statSync(tmpobj.name);
utimesSync(tmpobj.name, stats.atimeMs - 9999, stats.mtimeMs - 9999);
writeFileSync(tmpFile, css);
const stats = statSync(tmpFile);
utimesSync(tmpFile, stats.atimeMs - 9999, stats.mtimeMs - 9999);
}

@@ -52,4 +53,4 @@

// context when logging to console
this.callback(new Error(err.toString() + '\n' + err.frame));
this.callback(new Error(err.toString()));
}
};
{
"name": "svelte-loader",
"version": "2.2.1",
"version": "2.2.2",
"author": "Nico Rehwaldt <git_nikku@nixis.de>",

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

"sinon-chai": "^2.8.0",
"svelte": "^1.6.0"
"svelte": "^1.49.1"
},

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

@@ -28,3 +28,3 @@ # svelte-loader

Checkout [example setup](./example).
Check out the [example project](https://github.com/sveltejs/template-webpack).

@@ -31,0 +31,0 @@ ### Extracting CSS

@@ -60,3 +60,3 @@ /* global describe, it */

expect(err.message).to.eql(d`
ParseError: Expected }}}
Expected }}} (1:18)
1: <p>Count: {{{count}}</p>

@@ -83,3 +83,3 @@ ^

expect(err.message).to.eql(d`
ParseError: Unexpected token
Unexpected token (5:7)
3: <script>

@@ -99,3 +99,3 @@ 4: export {

it(
'should validation error',
'should handle validation error',
testLoader('test/fixtures/validation-error.html', function(

@@ -110,3 +110,3 @@ err,

expect(err.message).to.eql(d`
ValidationError: Computed properties can be function expressions or arrow function expressions
Computed properties can be function expressions or arrow function expressions (6:11)
4: export default {

@@ -113,0 +113,0 @@ 5: computed: {

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