Skip to content
Permalink
Browse files

fix: webpack tests (#414)

#413 got things working, now the tests pass too!
  • Loading branch information...
tivac committed Mar 8, 2018
1 parent 7b2f285 commit d24080580e9f8740b75557a963f2be2dcb0c9d60
@@ -170,7 +170,7 @@ function callAll(fns) {
}

function _mount(target, anchor) {
this._fragment.m(target, anchor);
this._fragment[this._fragment.i ? 'i' : 'm'](target, anchor || null);
}

function _unmount() {
@@ -194,7 +194,7 @@ var proto = {



function create_main_fragment(state, component) {
function create_main_fragment(component, state) {
var div, h1, text_1, div_1, p, p_class_value;

return {
@@ -238,11 +238,11 @@ function Svelte(options) {
init(this, options);
this._state = assign({}, options.data);

this._fragment = create_main_fragment(this._state, this);
this._fragment = create_main_fragment(this, this._state);

if (options.target) {
this._fragment.c();
this._fragment.m(options.target, options.anchor || null);
this._mount(options.target, options.anchor);
}
}

@@ -8,9 +8,9 @@ var utils = require("loader-utils"),
module.exports = function(source) {
var options = utils.getOptions(this) || false,
done = this.async(),
processor = this.options
? this.options.processor // Webpack 2 & 3
: this._compiler.options.processor; // Webpack 4
processor = this.options ?
this.options.processor : // Webpack 2 & 3
this._compiler.options.processor; // Webpack 4

if(options.cjs) {
this.emitWarning(
@@ -25,6 +25,7 @@
"dependencies": {
"esutils": "^2.0.2",
"loader-utils": "^1.1.0",
"lodash.ismap": "^4.4.2",
"modular-css-core": "^8.1.0",
"webpack-sources": "^1.0.1"
}
@@ -1,7 +1,8 @@
"use strict";

var sources = require("webpack-sources"),
Processor = require("modular-css-core");
Processor = require("modular-css-core"),
ismap = require("lodash.ismap");

// Return a list of changed/removed files based on timestamp objects
function getChangedFiles(prev, curr) {
@@ -36,7 +37,7 @@ ModularCSS.prototype.apply = function(compiler) {
compiler.plugin("invalid", (file) => {
this.processor.remove(file);
});

compiler.plugin("watch-run", (c, done) => {
watching = true;

@@ -53,7 +54,15 @@ ModularCSS.prototype.apply = function(compiler) {
// This code is only useful when calling .run() multiple times
// watching handles its own invalidations
if(!watching) {
files = getChangedFiles(this.prev, compilation.fileTimestamps);
let current;

if(ismap(compilation.fileTimestamps)) {
current = {};

compilation.fileTimestamps.forEach((value, key) => (current[key] = value));
}

files = getChangedFiles(this.prev, current || compilation.fileTimestamps);

// Remove changed/removed files from processor instance
this.processor.remove(files);

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit d240805

Please sign in to comment.
You can’t perform that action at this time.