Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests for #413 #414

Merged
merged 5 commits into from Mar 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/svelte/test/__snapshots__/rollup.test.js.snap
Expand Up @@ -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() {
Expand All @@ -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 {
Expand Down Expand Up @@ -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);
}
}

Expand Down
6 changes: 3 additions & 3 deletions packages/webpack/loader.js
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions packages/webpack/package.json
Expand Up @@ -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"
}
Expand Down
15 changes: 12 additions & 3 deletions packages/webpack/plugin.js
@@ -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) {
Expand Down Expand Up @@ -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;

Expand All @@ -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);
Expand Down
21 changes: 0 additions & 21 deletions packages/webpack/test/__snapshots__/change.json

This file was deleted.

21 changes: 0 additions & 21 deletions packages/webpack/test/__snapshots__/default.json

This file was deleted.

21 changes: 0 additions & 21 deletions packages/webpack/test/__snapshots__/es2015-default.json

This file was deleted.

21 changes: 0 additions & 21 deletions packages/webpack/test/__snapshots__/es2015-named.json

This file was deleted.

21 changes: 0 additions & 21 deletions packages/webpack/test/__snapshots__/invalid-name.json

This file was deleted.

21 changes: 0 additions & 21 deletions packages/webpack/test/__snapshots__/invalid.json

This file was deleted.

21 changes: 0 additions & 21 deletions packages/webpack/test/__snapshots__/name.json

This file was deleted.

21 changes: 0 additions & 21 deletions packages/webpack/test/__snapshots__/named.json

This file was deleted.

25 changes: 0 additions & 25 deletions packages/webpack/test/__snapshots__/simple.json

This file was deleted.

21 changes: 0 additions & 21 deletions packages/webpack/test/__snapshots__/start.json

This file was deleted.

21 changes: 0 additions & 21 deletions packages/webpack/test/__snapshots__/watch.json

This file was deleted.