chore: update all deps

This commit is contained in:
Dylan Piercey 2021-03-17 20:21:47 -07:00 committed by Dylan Piercey
parent ec89afd5fb
commit 4e0235419d
918 changed files with 6590 additions and 6549 deletions

4
.prettierrc Normal file
View File

@ -0,0 +1,4 @@
{
"arrowParens": "avoid",
"trailingComma": "none"
}

9783
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -20,40 +20,40 @@
"set-entry": "lerna exec -- dot-json package.json main $\\(dot-json package.json $ENTRY\\)"
},
"devDependencies": {
"@babel/cli": "^7.7.7",
"@babel/core": "^7.7.7",
"@babel/plugin-proposal-class-properties": "^7.7.4",
"@babel/plugin-proposal-private-methods": "^7.7.4",
"@babel/plugin-transform-runtime": "^7.7.6",
"@babel/preset-env": "^7.7.7",
"@babel/register": "^7.7.7",
"@commitlint/cli": "^8.2.0",
"@commitlint/config-conventional": "^8.2.0",
"@commitlint/config-lerna-scopes": "^8.2.0",
"@ebay/browserslist-config": "^1.0.1",
"@types/babel__traverse": "^7.0.15",
"@babel/cli": "^7.13.10",
"@babel/core": "^7.13.10",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-proposal-private-methods": "^7.13.0",
"@babel/plugin-transform-runtime": "^7.13.10",
"@babel/preset-env": "^7.13.10",
"@babel/register": "^7.13.8",
"@commitlint/cli": "^12.1.0",
"@commitlint/config-conventional": "^12.1.0",
"@commitlint/config-lerna-scopes": "^12.1.0",
"@ebay/browserslist-config": "^1.2.0",
"@types/babel__traverse": "^7.11.1",
"babel-plugin-istanbul": "^6.0.0",
"babel-plugin-minprops": "^2.0.1",
"bluebird": "^3.4.7",
"chai": "^4.2.0",
"codecov": "^3.6.1",
"cross-env": "^6.0.3",
"diffable-html": "^2.1.0",
"dot-json": "^1.1.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0",
"express": "^4.16.1",
"husky": "^3.1.0",
"it-fails": "^1.0.4",
"jsdom-context-require": "^1.0.1",
"lerna": "^3.19.0",
"lint-staged": "^9.5.0",
"mocha": "^5.2.0",
"mocha-autotest": "^1.0.3",
"nyc": "^15.0.0",
"prettier": "^1.19.1",
"bluebird": "^3.7.2",
"chai": "^4.3.4",
"codecov": "^3.8.1",
"cross-env": "^7.0.3",
"diffable-html": "^4.0.0",
"dot-json": "^1.2.2",
"eslint": "^7.22.0",
"eslint-config-prettier": "^8.1.0",
"express": "^4.17.1",
"husky": "^4.3.8",
"it-fails": "^1.0.5",
"jsdom-context-require": "^2.0.1",
"lerna": "^4.0.0",
"lint-staged": "^10.5.4",
"mocha": "^8.3.2",
"mocha-autotest": "^1.1.0",
"nyc": "^15.1.0",
"prettier": "^2.2.1",
"shell-quote": "^1.7.2",
"through": "^2.3.4",
"through2": "^2.0.1"
"through": "^2.3.8",
"through2": "^4.0.2"
}
}

View File

@ -5,8 +5,8 @@
"author": "Dylan Piercey <dpiercey@ebay.com>",
"bugs": "https://github.com/marko-js/marko/issues/new?template=Bug_report.md",
"dependencies": {
"@babel/runtime": "^7.7.7",
"jsesc": "^2.5.2"
"@babel/runtime": "^7.13.10",
"jsesc": "^3.0.2"
},
"devDependencies": {
"@marko/compiler": "^5.4.2"

View File

@ -202,10 +202,7 @@ export function getTemplateId(optimize, request) {
const id = relative(ROOT, request);
if (optimize) {
return createHash("MD5")
.update(id)
.digest("base64")
.slice(0, 8);
return createHash("MD5").update(id).digest("base64").slice(0, 8);
}
return id;

View File

@ -5,29 +5,29 @@
"author": "Dylan Piercey <dpiercey@ebay.com>",
"bugs": "https://github.com/marko-js/marko/issues/new?template=Bug_report.md",
"dependencies": {
"@babel/code-frame": "^7.5.5",
"@babel/core": "^7.7.7",
"@babel/generator": "^7.7.7",
"@babel/parser": "^7.7.7",
"@babel/plugin-transform-modules-commonjs": "^7.7.7",
"@babel/runtime": "^7.7.7",
"@babel/traverse": "^7.7.4",
"@babel/types": "^7.7.4",
"@babel/code-frame": "^7.12.13",
"@babel/core": "^7.13.10",
"@babel/generator": "^7.13.9",
"@babel/parser": "^7.13.11",
"@babel/plugin-transform-modules-commonjs": "^7.13.8",
"@babel/runtime": "^7.13.10",
"@babel/traverse": "^7.13.0",
"@babel/types": "^7.13.0",
"@marko/babel-utils": "^5.4.2",
"complain": "^1.6.0",
"enhanced-resolve": "5.0.0",
"he": "^1.1.0",
"htmljs-parser": "^2.9.0",
"jsesc": "^2.5.2",
"lasso-caching-fs": "^1.0.1",
"enhanced-resolve": "5.7.0",
"he": "^1.2.0",
"htmljs-parser": "^2.9.1",
"jsesc": "^3.0.2",
"lasso-caching-fs": "^1.0.2",
"lasso-package-root": "^1.0.1",
"property-handlers": "^1.0.0",
"raptor-regexp": "^1.0.0",
"property-handlers": "^1.1.1",
"raptor-regexp": "^1.0.1",
"raptor-util": "^3.2.0",
"resolve-from": "^5.0.0",
"self-closing-tags": "^1.0.1",
"strip-ansi": "^5.2.0",
"strip-json-comments": "^2.0.1"
"strip-ansi": "^6.0.0",
"strip-json-comments": "^3.1.1"
},
"devDependencies": {
"@marko/translator-default": "^5.4.2"

View File

@ -88,9 +88,7 @@ export function getMarkoFile(code, jsParseOptions, markoOpts) {
const filename = jsParseOptions.sourceFileName;
const id = getTemplateId(markoOpts.optimize, filename);
const contentHash = createHash("MD5")
.update(code)
.digest("hex");
const contentHash = createHash("MD5").update(code).digest("hex");
const cacheKey = createHash("MD5")
.update(id)
.update(markoOpts.migrate ? "\0migrate" : "")

View File

@ -9,10 +9,10 @@ MARKO_TYPES.forEach(typeName => {
const assertKey = `assert${typeName}`;
const checkFn = t[checkKey];
const assertFn = t[assertKey];
NodePath.prototype[checkKey] = function(opts) {
NodePath.prototype[checkKey] = function (opts) {
return checkFn(this.node, opts);
};
NodePath.prototype[assertKey] = function(opts) {
NodePath.prototype[assertKey] = function (opts) {
assertFn(this.node, opts);
};
});
@ -20,7 +20,7 @@ MARKO_TYPES.forEach(typeName => {
MARKO_ALIAS_TYPES.forEach(aliasName => {
const checkKey = `is${aliasName}`;
const originalProtoCheck = NodePath.prototype[checkKey];
NodePath.prototype[checkKey] = function(opts) {
NodePath.prototype[checkKey] = function (opts) {
return (
t.is(aliasName, this.node, opts) ||
originalProtoCheck.call(this, this.node, opts)
@ -31,10 +31,10 @@ MARKO_ALIAS_TYPES.forEach(aliasName => {
// Adds a one time patch to the scope collector visitors to include
// Marko bindings for params and tag vars.
const originalCrawl = Scope.prototype.crawl;
Scope.prototype.crawl = function() {
Scope.prototype.crawl = function () {
const path = this.path;
const originalTraverse = path.traverse;
path.traverse = function(visitor) {
path.traverse = function (visitor) {
Object.assign(
traverse.explode(visitor),
traverse.explode({

View File

@ -1,3 +1,4 @@
/* eslint-disable no-import-assign */
import * as babelTypes from "@babel/types";
import builder from "@babel/types/lib/builders/builder";
import defineType from "@babel/types/lib/definitions/utils";

View File

@ -65,10 +65,10 @@ function find(dirname, registeredTaglibs) {
var added = {};
var helper = {
alreadyAdded: function(taglibPath) {
alreadyAdded: function (taglibPath) {
return hasOwnProperty.call(added, taglibPath);
},
addTaglib: function(taglib) {
addTaglib: function (taglib) {
if (added[taglib.path]) {
return;
}

View File

@ -41,7 +41,7 @@ class Tag {
}
forEachTransformer(callback, thisObj) {
forEachEntry(this.transformers, function(key, transformer) {
forEachEntry(this.transformers, function (key, transformer) {
callback.call(thisObj, transformer);
});
}
@ -132,7 +132,7 @@ class Tag {
return;
}
forEachEntry(this.nestedTags, function(key, nestedTag) {
forEachEntry(this.nestedTags, function (key, nestedTag) {
callback.call(thisObj, nestedTag);
});
}

View File

@ -20,7 +20,7 @@ function handleImport(taglib, importedTaglib) {
taglib.imports.push(importedTaglib);
if (importedTaglib.imports) {
importedTaglib.imports.forEach(function(nestedImportedTaglib) {
importedTaglib.imports.forEach(function (nestedImportedTaglib) {
handleImport(taglib, nestedImportedTaglib);
});
}
@ -78,7 +78,7 @@ class Taglib {
forEachTag(callback, thisObj) {
forEachEntry(
this.tags,
function(key, tag) {
function (key, tag) {
callback.call(thisObj, tag);
},
this

View File

@ -2,7 +2,7 @@ var fs = require("fs");
var stripJsonComments = require("strip-json-comments");
var fsReadOptions = { encoding: "utf8" };
exports.readFileSync = function(path) {
exports.readFileSync = function (path) {
var json = fs.readFileSync(path, fsReadOptions);
try {

View File

@ -236,7 +236,7 @@ function loadAttributeFromProps(attrName, attrProps, dependencyChain) {
return attr;
}
loadAttributeFromProps.isSupportedProperty = function(name) {
loadAttributeFromProps.isSupportedProperty = function (name) {
return hasOwnProperty.call(AttrLoader.prototype, name);
};

View File

@ -17,7 +17,7 @@ function resolveRelative(dirname, value) {
}
function removeDashes(str) {
return str.replace(/-([a-z])/g, function(match, lower) {
return str.replace(/-([a-z])/g, function (match, lower) {
return lower.toUpperCase();
});
}
@ -128,11 +128,11 @@ class TagLoader {
propertyHandlers(
value,
{
name: function(value) {
name: function (value) {
nestedVariable.name = value;
},
nameFromAttribute: function(value) {
nameFromAttribute: function (value) {
nestedVariable.nameFromAttribute = value;
}
},

View File

@ -93,7 +93,7 @@ class TaglibLookup {
var merged = this.merged;
function handleNestedTags(tag, parentTagName) {
tag.forEachNestedTag(function(nestedTag) {
tag.forEachNestedTag(function (nestedTag) {
var fullyQualifiedName = parentTagName + ":" + nestedTag.name;
// Create a clone of the nested tag since we need to add some new
// properties
@ -108,7 +108,7 @@ class TaglibLookup {
});
}
taglib.forEachTag(function(tag) {
taglib.forEachTag(function (tag) {
handleNestedTags(tag, tag.name);
});
}

View File

@ -91,7 +91,7 @@ module.exports = {
},
increment() {
this.state.count++;
},
}
};
```

View File

@ -87,7 +87,7 @@ var args = require("argly")
"Delete all *.marko.js files in the current directory",
"$0 . --clean"
)
.validate(function(result) {
.validate(function (result) {
if (result.help) {
this.printUsage();
process.exit(0);
@ -104,7 +104,7 @@ var args = require("argly")
process.exit(1);
}
})
.onError(function(err) {
.onError(function (err) {
this.printUsage();
if (err) {
@ -141,7 +141,7 @@ if (force) {
var paths = args.paths;
if (paths && paths.length) {
paths.forEach(function(path) {
paths.forEach(function (path) {
appModulePath.addPath(nodePath.resolve(cwd, path));
});
}
@ -152,12 +152,12 @@ if (!ignoreRules) {
ignoreRules = ["/node_modules", ".*"];
}
ignoreRules = ignoreRules.filter(function(s) {
ignoreRules = ignoreRules.filter(function (s) {
s = s.trim();
return s && !s.match(/^#/);
});
ignoreRules = ignoreRules.map(function(pattern) {
ignoreRules = ignoreRules.map(function (pattern) {
return new Minimatch(pattern, mmOptions);
});
@ -213,10 +213,10 @@ function walk(files, options, done) {
var fileCallback = options.file;
var context = {
errors: [],
beginAsync: function() {
beginAsync: function () {
pending++;
},
endAsync: function(err) {
endAsync: function (err) {
if (err) {
this.errors.push(err);
}
@ -235,17 +235,17 @@ function walk(files, options, done) {
function doWalk(dir) {
context.beginAsync();
fs.readdir(dir, function(err, list) {
fs.readdir(dir, function (err, list) {
if (err) {
return context.endAsync(err);
}
if (list.length) {
list.forEach(function(basename) {
list.forEach(function (basename) {
var file = nodePath.join(dir, basename);
context.beginAsync();
fs.stat(file, function(err, stat) {
fs.stat(file, function (err, stat) {
if (err) {
return context.endAsync(err);
}
@ -286,7 +286,7 @@ if (args.clean) {
walk(
args.files,
{
file: function(file, context) {
file: function (file, context) {
var basename = nodePath.basename(file);
if (
@ -295,7 +295,7 @@ if (args.clean) {
basename.endsWith(".marko.xml.js")
) {
context.beginAsync();
fs.unlink(file, function(err) {
fs.unlink(file, function (err) {
if (err) {
return context.endAsync(err);
}
@ -306,7 +306,7 @@ if (args.clean) {
}
}
},
function() {
function () {
if (deleteCount === 0) {
console.log("No *.marko.js files were found. Already clean.");
} else {
@ -319,7 +319,7 @@ if (args.clean) {
var compileCount = 0;
var failed = [];
var compile = function(path, context) {
var compile = function (path, context) {
if (found[path]) {
return;
}
@ -338,7 +338,7 @@ if (args.clean) {
context.beginAsync();
markoCompiler.compileFile(path, compileOptions, function(err, result) {
markoCompiler.compileFile(path, compileOptions, function (err, result) {
if (err) {
failed.push(
'Failed to compile "' +
@ -352,7 +352,7 @@ if (args.clean) {
var src = result.code;
context.beginAsync();
fs.writeFile(outPath, src, "utf8", function(err) {
fs.writeFile(outPath, src, "utf8", function (err) {
if (err) {
failed.push(
'Failed to write "' + path + '". Error: ' + (err.stack || err)
@ -366,7 +366,7 @@ if (args.clean) {
outPath + ".map",
JSON.stringify(result.map),
"utf-8",
function(err) {
function (err) {
if (err) {
failed.push(
'Failed to write sourcemap"' +
@ -398,7 +398,7 @@ if (args.clean) {
walk(
args.files,
{
file: function(file, context) {
file: function (file, context) {
var basename = nodePath.basename(file);
if (
@ -410,7 +410,7 @@ if (args.clean) {
}
}
},
function(err) {
function (err) {
if (err) {
if (failed.length) {
console.error(

View File

@ -4,8 +4,8 @@ We're used to passing body content to HTML tags. When you do this, the tag has c
```html
<details>
<summary>Hello <strong>World</strong></summary> This is some
<em>content</em> that can be toggled.
<summary>Hello <strong>World</strong></summary>
This is some <em>content</em> that can be toggled.
</details>
```

View File

@ -142,12 +142,12 @@ If you target browsers that does not support classes, a plain object of methods
```js
module.exports = {
onCreate: function() {
onCreate: function () {
this.state = {
count: 0
};
},
increment: function() {
increment: function () {
this.state.count++;
}
};
@ -883,7 +883,7 @@ class {
> **ProTip:** When a lifecycle event occurs in the browser, the corresponding event is emitted on the component instance. A parent component, or other code that has access to the component instance, can listen for these events. For example:
>
> ```js
> component.on("input", function(input, out) {
> component.on("input", function (input, out) {
> // The component received an input
> });
> ```

View File

@ -31,7 +31,7 @@ var app = express();
app.use(markoExpress()); //enable res.marko(template, data)
app.get("/", function(req, res) {
app.get("/", function (req, res) {
res.marko(template, {
name: "Frank",
count: 30,

View File

@ -59,6 +59,7 @@ Marko templates can be imported and rendered by any JavaScript module. The code
_client.js_
<!-- prettier-ignore -->
```js
require("./components/app/index.marko")
.renderSync({})

View File

@ -40,7 +40,7 @@ class {
### `reducer.js`
```js
module.exports = function(state, action) {
module.exports = function (state, action) {
state = state || { value: 0 };
// Additional reducer logic here…

View File

@ -5,7 +5,7 @@ Marko allows any Marko template/UI component to be rendered on the server or in
```js
var template = require("./template"); // Import ./template.marko
module.exports = function(req, res) {
module.exports = function (req, res) {
res.setHeader("Content-Type", "text/html; charset=utf-8");
template.render({ name: "Frank" }, res);
};
@ -16,7 +16,7 @@ Marko can also provide you with a `Readable` stream.
```js
var template = require("./template"); // Import ./template.marko
module.exports = function(req) {
module.exports = function (req) {
// Return a Readable stream for someone to do something with:
return template.stream({ name: "Frank" });
};

View File

@ -68,6 +68,7 @@ function render(input, out) {
#### Compiled for the browser
<!-- prettier-ignore -->
```js
var marko_template = require("marko/vdom").t(__filename);
@ -178,6 +179,7 @@ Given the following template:
Marko will produce the following compiled output:
<!-- prettier-ignore -->
```js
var marko_attrs0 = {
class: "hello"

View File

@ -4,15 +4,15 @@
"license": "MIT",
"description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
"dependencies": {
"@marko/compiler": "^5.2.2",
"@marko/translator-default": "^5.3.0",
"@marko/compiler": "^5.4.2",
"@marko/translator-default": "^5.4.2",
"app-module-path": "^2.2.0",
"argly": "^1.0.0",
"argly": "^1.2.0",
"browser-refresh-client": "1.1.4",
"complain": "^1.6.0",
"events-light": "^1.0.0",
"events-light": "^1.0.5",
"listener-tracker": "^2.0.0",
"minimatch": "^3.0.2",
"minimatch": "^3.0.4",
"raptor-util": "^3.2.0",
"resolve-from": "^5.0.0",
"self-closing-tags": "^1.0.1",

View File

@ -17,7 +17,7 @@ if ("MARKO_DEBUG") {
}
var defaultOptionsExportDefinition = {
get: function() {
get: function () {
return globalConfig;
},
enumerable: true,
@ -109,7 +109,7 @@ function compileFile(filename, options, callback) {
options.sourceOnly = options.sourceOnly !== false;
if (callback) {
fs.readFile(filename, { encoding: "utf8" }, function(err, templateSrc) {
fs.readFile(filename, { encoding: "utf8" }, function (err, templateSrc) {
if (err) {
return callback(err);
}
@ -148,7 +148,7 @@ exports.clearCaches = function clearCaches() {
taglib.clearCache();
};
exports.registerTaglib = function(filePath) {
exports.registerTaglib = function (filePath) {
ok(typeof filePath === "string", '"filePath" should be a string');
taglib.registerFromFile(filePath);
exports.clearCaches();

View File

@ -38,7 +38,7 @@ module.exports = function render(input, out) {
// rendered asynchronously, but were outside an `<await>` tag
// (each `<await>` tag will have its own component initialization block)
const asyncOut = out.beginAsync({ last: true, timeout: -1 });
out.onLast(function(next) {
out.onLast(function (next) {
// Ensure we're getting init code starting from the root
let rootOut = out;
while (rootOut._parentOut) {

View File

@ -16,7 +16,7 @@ module.exports = function render(input, out) {
forceScriptTagAtThisPoint(out);
} else {
const asyncOut = out.beginAsync({ last: true, timeout: -1 });
out.onLast(function(next) {
out.onLast(function (next) {
forceScriptTagAtThisPoint(asyncOut);
asyncOut.end();
next();

View File

@ -46,7 +46,7 @@ AsyncValue.prototype = {
* The given callback will be invoked when there is an error or resolved data
* available.
*/
___done: function(callback) {
___done: function (callback) {
// Do we already have data or error?
if (this.___settled) {
// invoke the callback immediately
@ -63,7 +63,7 @@ AsyncValue.prototype = {
* its initial state so that any future requests to load data will trigger a
* new load call.
*/
___reject: function(err) {
___reject: function (err) {
if (this.___settled) {
return;
}
@ -84,7 +84,7 @@ AsyncValue.prototype = {
/**
* This method will trigger any callbacks to be notified of data.
*/
___resolve: function(value) {
___resolve: function (value) {
if (this.___settled) {
return;
}

View File

@ -1,6 +1,6 @@
exports.isSupported = true;
exports.getCode = function() {
exports.getCode = function () {
// Minified version of ./client-reorder-runtime.js
return `function $af(d,a,e,l,g,h,k,b,f,c){c=$af;if(a&&!c[a])(c[a+="$"]||(c[a]=[])).push(d);else{e=document;l=e.getElementById("af"+d);g=e.getElementById("afph"+d);h=e.createDocumentFragment();k=l.childNodes;b=0;for(f=k.length;b<f;b++)h.appendChild(k.item(0));g&&g.parentNode.replaceChild(h,g);c[d]=1;if(a=c[d+"$"])for(b=0,f=a.length;b<f;b++)c(a[b])}}`;
};

View File

@ -23,7 +23,7 @@ function requestData(provider, timeout) {
);
}
var callback = function(err, data) {
var callback = function (err, data) {
if (err) {
asyncValue.___reject(err);
} else {
@ -60,7 +60,7 @@ function requestData(provider, timeout) {
error = new Error(errorMsg);
}
if (timeout > 0) {
let timeoutId = setTimeout(function() {
let timeoutId = setTimeout(function () {
timeoutId = null;
if (!error) error = new Error(errorMsg);
error.code = "ERR_AWAIT_TIMEDOUT";
@ -68,7 +68,7 @@ function requestData(provider, timeout) {
asyncValue.___reject(error);
}, timeout);
asyncValue.___done(function() {
asyncValue.___done(function () {
if (timeoutId != null) {
clearTimeout(timeoutId);
}
@ -139,7 +139,7 @@ module.exports = function awaitTag(input, out) {
// - await:beforeRender
// - await:finish
//
asyncOut.emit = function(event) {
asyncOut.emit = function (event) {
if (event !== "finish" && event !== "error") {
// We don't want to proxy the finish and error events since those are
// very specific to the AsyncWriter associated with the await instance
@ -192,7 +192,7 @@ module.exports = function awaitTag(input, out) {
// this event until after the code to move
// the async fragment into place has been written
let asyncLastOut = asyncOut.beginAsync(LAST_OPTIONS);
asyncOut.onLast(function() {
asyncOut.onLast(function () {
var oldWriter = asyncOut.writer;
// We swap out the writer so that writing will happen to our `asyncLastOut`
// even though we are still passing along the original `asyncOut`. We have

View File

@ -2,7 +2,7 @@
const clientReorder = require("./client-reorder");
module.exports = function(input, out) {
module.exports = function (input, out) {
// We cannot call beginSync() when using renderSync(). In this case we will
// ignore the await-reorderer tag.
if (out.isSync()) {
@ -29,7 +29,7 @@ module.exports = function(input, out) {
name: "await-reorderer"
});
out.onLast(function(next) {
out.onLast(function (next) {
var awaitContext = global.___clientReorderContext;
var remaining;
@ -47,7 +47,7 @@ module.exports = function(input, out) {
function handleAwait(awaitInfo) {
awaitInfo.out
.on("___toString", out.emit.bind(out, "___toString"))
.on("finish", function(result) {
.on("finish", function (result) {
if (!global._afRuntime) {
asyncOut.script(clientReorder.getCode());
global._afRuntime = true;
@ -81,14 +81,14 @@ module.exports = function(input, out) {
next();
}
})
.on("error", function(err) {
.on("error", function (err) {
asyncOut.error(err);
});
}
awaitContext.instances.forEach(handleAwait);
out.on("await:clientReorder", function(awaitInfo) {
out.on("await:clientReorder", function (awaitInfo) {
remaining++;
handleAwait(awaitInfo);
});

View File

@ -102,7 +102,7 @@ function _endsWithMarkoExtension(request, requireExtensions) {
return false;
}
exports.handleFileModified = function(filename) {
exports.handleFileModified = function (filename) {
if (!fs.existsSync(filename)) {
console.log(
"[marko/hot-reload] WARNING cannot resolve template path: ",

View File

@ -87,7 +87,7 @@ install();
exports.install = install;
exports.getExtensions = function() {
exports.getExtensions = function () {
return require.extensions[MARKO_EXTENSIONS];
};

View File

@ -18,10 +18,10 @@ function RenderResult(out) {
module.exports = RenderResult;
var proto = (RenderResult.prototype = {
getComponent: function() {
getComponent: function () {
return this.getComponents()[0];
},
getComponents: function(selector) {
getComponents: function (selector) {
if (this.___components === undefined) {
throw Error("Not added to DOM");
}
@ -30,7 +30,7 @@ var proto = (RenderResult.prototype = {
var components = [];
componentDefs.forEach(function(componentDef) {
componentDefs.forEach(function (componentDef) {
var component = componentDef.___component;
if (!selector || selector(component)) {
components.push(component);
@ -40,7 +40,7 @@ var proto = (RenderResult.prototype = {
return components;
},
afterInsert: function(doc) {
afterInsert: function (doc) {
var out = this.___out;
var componentsContext = out.___components;
if (componentsContext) {
@ -51,20 +51,20 @@ var proto = (RenderResult.prototype = {
return this;
},
getNode: function(doc) {
getNode: function (doc) {
return this.___out.___getNode(doc);
},
getOutput: function() {
getOutput: function () {
return this.___out.___getOutput();
},
toString: function() {
toString: function () {
return this.___out.toString();
},
document: typeof document != "undefined" && document
});
Object.defineProperty(proto, "html", {
get: function() {
get: function () {
// eslint-disable-next-line no-constant-condition
if ("MARKO_DEBUG") {
complain(
@ -76,7 +76,7 @@ Object.defineProperty(proto, "html", {
});
Object.defineProperty(proto, "context", {
get: function() {
get: function () {
// eslint-disable-next-line no-constant-condition
if ("MARKO_DEBUG") {
complain(

View File

@ -119,7 +119,7 @@ function processUpdateHandlers(component, stateChanges, oldState) {
// Otherwise, there are handlers for all of the changed properties
// so apply the updates using those handlers
handlers.forEach(function(handler) {
handlers.forEach(function (handler) {
var propertyName = handler[0];
handlerMethod = handler[1];
@ -199,7 +199,7 @@ function Component(id) {
Component.prototype = componentProto = {
___isComponent: true,
subscribeTo: function(target) {
subscribeTo: function (target) {
if (!target) {
throw TypeError();
}
@ -215,7 +215,7 @@ Component.prototype = componentProto = {
return subscriptions.subscribeTo(target, subscribeToOptions);
},
emit: function(eventType) {
emit: function (eventType) {
var customEvents = this.___customEvents;
var target;
@ -239,13 +239,13 @@ Component.prototype = componentProto = {
return emit.apply(this, arguments);
},
getElId: function(key, index) {
getElId: function (key, index) {
if (!key) {
return this.id;
}
return resolveComponentIdHelper(this, key, index);
},
getEl: function(key, index) {
getEl: function (key, index) {
if (key) {
var keyedElement = this.___keyedElements[
"@" + resolveKeyHelper(key, index)
@ -268,7 +268,7 @@ Component.prototype = componentProto = {
return this.el;
}
},
getEls: function(key) {
getEls: function (key) {
key = key + "[]";
var els = [];
@ -280,7 +280,7 @@ Component.prototype = componentProto = {
}
return els;
},
getComponent: function(key, index) {
getComponent: function (key, index) {
var rootNode = this.___keyedElements["@" + resolveKeyHelper(key, index)];
// eslint-disable-next-line no-constant-condition
if ("MARKO_DEBUG") {
@ -293,17 +293,17 @@ Component.prototype = componentProto = {
return rootNode && componentsByDOMNode.get(rootNode);
},
getComponents: function(key) {
getComponents: function (key) {
var lookup = this.___keyedElements["@" + key + "[]"];
return lookup
? Object.keys(lookup)
.map(function(key) {
.map(function (key) {
return componentsByDOMNode.get(lookup[key]);
})
.filter(Boolean)
: [];
},
destroy: function() {
destroy: function () {
if (this.___destroyed) {
return;
}
@ -314,7 +314,7 @@ Component.prototype = componentProto = {
var nodes = root.nodes;
nodes.forEach(function(node) {
nodes.forEach(function (node) {
destroyNodeRecursive(node);
if (eventDelegation.___handleNodeDetach(node) !== false) {
@ -328,7 +328,7 @@ Component.prototype = componentProto = {
this.___keyedElements = {};
},
___destroyShallow: function() {
___destroyShallow: function () {
if (this.___destroyed) {
return;
}
@ -350,7 +350,7 @@ Component.prototype = componentProto = {
}
},
isDestroyed: function() {
isDestroyed: function () {
return this.___destroyed;
},
get state() {
@ -376,7 +376,7 @@ Component.prototype = componentProto = {
this.___state = null;
}
},
setState: function(name, value) {
setState: function (name, value) {
var state = this.___state;
if (!state) {
@ -395,7 +395,7 @@ Component.prototype = componentProto = {
}
},
setStateDirty: function(name, value) {
setStateDirty: function (name, value) {
var state = this.___state;
if (arguments.length == 1) {
@ -410,7 +410,7 @@ Component.prototype = componentProto = {
);
},
replaceState: function(newState) {
replaceState: function (newState) {
this.___state.___replace(newState);
},
@ -425,7 +425,7 @@ Component.prototype = componentProto = {
}
},
___setInput: function(newInput, onInput, out) {
___setInput: function (newInput, onInput, out) {
onInput = onInput || this.onInput;
var updatedInput;
@ -457,19 +457,19 @@ Component.prototype = componentProto = {
return newInput;
},
forceUpdate: function() {
forceUpdate: function () {
this.___dirty = true;
this.___queueUpdate();
},
___queueUpdate: function() {
___queueUpdate: function () {
if (!this.___updateQueued) {
this.___updateQueued = true;
updateManager.___queueComponentUpdate(this);
}
},
update: function() {
update: function () {
if (this.___destroyed === true || this.___isDirty === false) {
return;
}
@ -502,7 +502,7 @@ Component.prototype = componentProto = {
);
},
___reset: function() {
___reset: function () {
this.___dirty = false;
this.___updateQueued = false;
this.___renderInput = null;
@ -512,11 +512,11 @@ Component.prototype = componentProto = {
}
},
shouldUpdate: function() {
shouldUpdate: function () {
return true;
},
___scheduleRerender: function() {
___scheduleRerender: function () {
var self = this;
var renderer = self.___renderer;
@ -526,14 +526,14 @@ Component.prototype = componentProto = {
var input = this.___renderInput || this.___input;
updateManager.___batchUpdate(function() {
updateManager.___batchUpdate(function () {
self.___rerender(input, false).afterInsert(self.___document);
});
this.___reset();
},
___rerender: function(input, isHydrate) {
___rerender: function (input, isHydrate) {
var doc = this.___document;
var globalData = this.___global;
var rootNode = this.___rootNode;
@ -560,13 +560,13 @@ Component.prototype = componentProto = {
return result;
},
___detach: function() {
___detach: function () {
var root = this.___rootNode;
root.remove();
return root;
},
___removeDOMEventListeners: function() {
___removeDOMEventListeners: function () {
var eventListenerHandles = this.___domEventListenerHandles;
if (eventListenerHandles) {
eventListenerHandles.forEach(removeListener);
@ -579,11 +579,11 @@ Component.prototype = componentProto = {
return state && state.___raw;
},
___setCustomEvents: function(customEvents, scope) {
___setCustomEvents: function (customEvents, scope) {
var finalCustomEvents = (this.___customEvents = {});
this.___scope = scope;
customEvents.forEach(function(customEvent) {
customEvents.forEach(function (customEvent) {
var eventType = customEvent[0];
var targetMethodName = customEvent[1];
var isOnce = customEvent[2];
@ -604,7 +604,7 @@ Component.prototype = componentProto = {
'The "this.els" attribute is deprecated. Please use "this.getEls(key)" instead.'
);
}
return (this.___rootNode ? this.___rootNode.nodes : []).filter(function(
return (this.___rootNode ? this.___rootNode.nodes : []).filter(function (
el
) {
return el.nodeType === ELEMENT_NODE;

View File

@ -34,7 +34,7 @@ function ComponentDef(component, componentId, componentsContext) {
}
ComponentDef.prototype = {
___nextKey: function(key) {
___nextKey: function (key) {
return (
this.___keySequence || (this.___keySequence = new KeySequence())
).___nextKey(key);
@ -44,7 +44,7 @@ ComponentDef.prototype = {
* This helper method generates a unique and fully qualified DOM element ID
* that is unique within the scope of the current component.
*/
elId: function(nestedId) {
elId: function (nestedId) {
var id = this.id;
if (nestedId == null) {
@ -70,11 +70,11 @@ ComponentDef.prototype = {
/**
* Returns the next auto generated unique ID for a nested DOM element or nested DOM component
*/
___nextComponentId: function() {
___nextComponentId: function () {
return this.id + "-c" + this.___nextIdIndex++;
},
d: function(eventName, handlerMethodName, isOnce, extraArgs) {
d: function (eventName, handlerMethodName, isOnce, extraArgs) {
addDelegatedEventHandler(eventName);
return attachBubblingEvent(this, handlerMethodName, isOnce, extraArgs);
},
@ -86,7 +86,7 @@ ComponentDef.prototype = {
ComponentDef.prototype.nk = ComponentDef.prototype.___nextKey;
ComponentDef.___deserialize = function(o, types, global, registry) {
ComponentDef.___deserialize = function (o, types, global, registry) {
var id = o[0];
var typeName = types[o[1]];
var input = o[2] || null;
@ -116,7 +116,7 @@ ComponentDef.___deserialize = function(o, types, global, registry) {
if (state) {
var undefinedPropNames = extra.u;
if (undefinedPropNames) {
undefinedPropNames.forEach(function(undefinedPropName) {
undefinedPropNames.forEach(function (undefinedPropName) {
state[undefinedPropName] = undefined;
});
}

View File

@ -36,7 +36,7 @@ function ComponentsContext(out, parentComponentsContext) {
}
ComponentsContext.prototype = {
___initComponents: function(doc) {
___initComponents: function (doc) {
var componentDefs = this.___components;
ComponentsContext.___initClientRendered(componentDefs, doc);

View File

@ -2,7 +2,7 @@ function KeySequence() {
this.___lookup = Object.create(null);
}
KeySequence.prototype.___nextKey = function(key) {
KeySequence.prototype.___nextKey = function (key) {
var lookup = this.___lookup;
if (lookup[key]) {

View File

@ -4,10 +4,10 @@ function ensure(state, propertyName) {
var proto = state.constructor.prototype;
if (!(propertyName in proto)) {
Object.defineProperty(proto, propertyName, {
get: function() {
get: function () {
return this.___raw[propertyName];
},
set: function(value) {
set: function (value) {
this.___set(propertyName, value, false /* ensure:false */);
}
});
@ -27,7 +27,7 @@ function State(component) {
}
State.prototype = {
___reset: function() {
___reset: function () {
var self = this;
self.___dirty = false;
@ -36,7 +36,7 @@ State.prototype = {
self.___forced = null;
},
___replace: function(newState) {
___replace: function (newState) {
var state = this;
var key;
@ -62,7 +62,7 @@ State.prototype = {
);
}
},
___set: function(name, value, shouldEnsure, forceDirty) {
___set: function (name, value, shouldEnsure, forceDirty) {
var rawState = this.___raw;
if (shouldEnsure) {
@ -97,7 +97,7 @@ State.prototype = {
rawState[name] = value;
}
},
toJSON: function() {
toJSON: function () {
return this.___raw;
}
};

View File

@ -17,7 +17,7 @@ function handleNodeAttach(node, componentsContext) {
var attachTargets = data.___attachTargets;
if (!attachTargets) {
attachTargets = data.___attachTargets = [];
out.on("___componentsInitialized", function() {
out.on("___componentsInitialized", function () {
for (var i = 0; i < attachTargets.length; i += 2) {
var node = attachTargets[i];
var target = attachTargets[i + 1];
@ -40,10 +40,10 @@ function handleNodeDetach(node) {
var allowDetach;
delegateEvent(node, eventName, target, {
preventDefault: function() {
preventDefault: function () {
allowDetach = false;
},
detach: function() {
detach: function () {
var parentNode = node.parentNode;
if (parentNode) {
parentNode.removeChild(node);

View File

@ -10,7 +10,7 @@ module.exports = function defineComponent(def, renderer) {
return def;
}
var ComponentClass = function() {};
var ComponentClass = function () {};
var proto;
var type = typeof def;

View File

@ -78,13 +78,13 @@ function addDelegatedEventHandlerToDoc(eventType, doc) {
if (!listeners[eventType]) {
body.addEventListener(
eventType,
(listeners[eventType] = function(event) {
(listeners[eventType] = function (event) {
var propagationStopped = false;
// Monkey-patch to fix #97
var oldStopPropagation = event.stopPropagation;
event.stopPropagation = function() {
event.stopPropagation = function () {
oldStopPropagation.call(event);
propagationStopped = true;
};
@ -133,8 +133,8 @@ exports.___handleNodeDetach = noop;
exports.___delegateEvent = delegateEvent;
exports.___getEventFromEl = getEventFromEl;
exports.___addDelegatedEventHandler = addDelegatedEventHandler;
exports.___init = function(doc) {
Object.keys(delegatedEvents).forEach(function(eventType) {
exports.___init = function (doc) {
Object.keys(delegatedEvents).forEach(function (eventType) {
addDelegatedEventHandlerToDoc(eventType, doc);
});
};

View File

@ -8,8 +8,8 @@ require("./ComponentsContext").___initClientRendered =
exports.getComponentForEl = componentsUtil.___getComponentForEl;
exports.init = window.$initComponents = initComponents.___initServerRendered;
exports.register = function(id, component) {
registry.r(id, function() {
exports.register = function (id, component) {
registry.r(id, function () {
return component;
});
};

View File

@ -148,7 +148,7 @@ function addComponentsFromContext(componentsContext, componentsToHydrate) {
// Also add any components from nested contexts
var nestedContexts = componentsContext.___nestedContexts;
if (nestedContexts !== undefined) {
nestedContexts.forEach(function(nestedContext) {
nestedContexts.forEach(function (nestedContext) {
addComponentsFromContext(nestedContext, componentsToHydrate);
});
}
@ -268,6 +268,6 @@ exports.writeInitComponentsCode = writeInitComponentsCode;
* @param {ComponentsContext|AsyncWriter} componentsContext A ComponentsContext or an AsyncWriter
* @return {Object} An object with information about the rendered components that can be serialized to JSON. The object should be treated as opaque
*/
exports.getRenderedComponents = function(out) {
exports.getRenderedComponents = function (out) {
return warp10.stringifyPrepare(getInitComponentsDataFromOut(out));
};

View File

@ -105,7 +105,7 @@ function indexServerComponentBoundaries(node, runtimeId, stack) {
keyedElements[markoKey] = node;
}
if (markoProps) {
Object.keys(markoProps).forEach(function(key) {
Object.keys(markoProps).forEach(function (key) {
if (key.slice(0, 2) === "on") {
eventDelegation.___addDelegatedEventHandler(key.slice(2));
}
@ -130,7 +130,7 @@ function invokeComponentEventHandler(component, targetMethodName, args) {
function addEventListenerHelper(el, eventType, isOnce, listener) {
var eventListener = listener;
if (isOnce) {
eventListener = function(event) {
eventListener = function (event) {
listener(event);
el.removeEventListener(eventType, eventListener);
};
@ -152,16 +152,19 @@ function addDOMEventListeners(
extraArgs,
handles
) {
var removeListener = addEventListenerHelper(el, eventType, isOnce, function(
event
) {
var args = [event, el];
if (extraArgs) {
args = extraArgs.concat(args);
}
var removeListener = addEventListenerHelper(
el,
eventType,
isOnce,
function (event) {
var args = [event, el];
if (extraArgs) {
args = extraArgs.concat(args);
}
invokeComponentEventHandler(component, targetMethodName, args);
});
invokeComponentEventHandler(component, targetMethodName, args);
}
);
handles.push(removeListener);
}
@ -181,7 +184,7 @@ function initComponent(componentDef, doc) {
if (domEvents) {
var eventListenerHandles = [];
domEvents.forEach(function(domEventArgs) {
domEvents.forEach(function (domEventArgs) {
// The event mapping is for a direct DOM event (not a custom event and not for bubblign dom events)
var eventType = domEventArgs[0];
@ -268,7 +271,7 @@ function initServerRendered(renderedComponents, doc) {
});
if (renderedComponents && renderedComponents.forEach) {
renderedComponents.forEach(function(renderedComponent) {
renderedComponents.forEach(function (renderedComponent) {
fakeArray.concat(renderedComponent);
});
}
@ -337,7 +340,7 @@ function initServerRendered(renderedComponents, doc) {
// hydrate components top down (leaf nodes last)
// and return an array of functions to mount these components
(renderedComponents.w || [])
.map(function(componentDef) {
.map(function (componentDef) {
var typeName = meta.___types[componentDef[1]];
return registry.___isRegistered(typeName)
@ -367,10 +370,10 @@ function tryHydrateComponent(rawDef, meta, doc, runtimeId) {
deferredDefs.push(componentDef);
} else {
deferredDefs = [componentDef];
doc.addEventListener("DOMContentLoaded", function() {
doc.addEventListener("DOMContentLoaded", function () {
indexServerComponentBoundaries(doc, runtimeId);
deferredDefs
.map(function(componentDef) {
.map(function (componentDef) {
return hydrateComponentAndGetMount(componentDef, doc);
})
.reverse()

View File

@ -20,8 +20,8 @@ function register(type, def) {
if (pendingForType) {
delete pendingDefs[type];
queueMicrotask(function() {
pendingForType.forEach(function(args) {
queueMicrotask(function () {
pendingForType.forEach(function (args) {
initComponents.___tryHydrateComponent(
args[0],
type,
@ -41,7 +41,7 @@ function addPendingDef(def, type, doc, runtimeId) {
// eslint-disable-next-line no-constant-condition
if ("MARKO_DEBUG") {
doc.addEventListener("load", function() {
doc.addEventListener("load", function () {
var pendingComponentIds = Object.keys(pendingDefs);
if (pendingComponentIds.length) {
complain(
@ -101,7 +101,7 @@ function getComponentClass(typeName) {
typeName
);
var className = classNameMatch ? classNameMatch[1] : "AnonymousComponent";
className = className.replace(/-(.)/g, function(g) {
className = className.replace(/-(.)/g, function (g) {
return g[1].toUpperCase();
});
className = className

View File

@ -141,13 +141,13 @@ function addComponentRootToKeyedElements(
// eslint-disable-next-line no-constant-condition
if ("MARKO_DEBUG") {
var warnNodeRemoved = function(event) {
var warnNodeRemoved = function (event) {
var fragment = event.target.fragment;
if (fragment) {
var baseError = new Error(
"Fragment boundary marker removed. This will cause an error when the fragment is updated."
);
fragment.___markersRemovedError = function(message) {
fragment.___markersRemovedError = function (message) {
var error = new Error(message + " Boundary markers missing.");
baseError.stack = baseError.stack.replace(/.*warnNodeRemoved.*\n/, "");
@ -158,10 +158,10 @@ if ("MARKO_DEBUG") {
};
}
};
exports.___startDOMManipulationWarning = function() {
exports.___startDOMManipulationWarning = function () {
document.addEventListener("DOMNodeRemoved", warnNodeRemoved);
};
exports.___stopDOMManipulationWarning = function() {
exports.___stopDOMManipulationWarning = function () {
document.removeEventListener("DOMNodeRemoved", warnNodeRemoved);
};
}

View File

@ -24,21 +24,21 @@ function beforeRemove(referenceEl) {
destroyComponentForNode(referenceEl);
}
module.exports = function(target, getEl, afterInsert) {
module.exports = function (target, getEl, afterInsert) {
extend(target, {
appendTo: function(referenceEl) {
appendTo: function (referenceEl) {
referenceEl = resolveEl(referenceEl);
var el = getEl(this, referenceEl);
insertBefore(el, null, referenceEl);
return afterInsert(this, referenceEl);
},
prependTo: function(referenceEl) {
prependTo: function (referenceEl) {
referenceEl = resolveEl(referenceEl);
var el = getEl(this, referenceEl);
insertBefore(el, referenceEl.firstChild || null, referenceEl);
return afterInsert(this, referenceEl);
},
replace: function(referenceEl) {
replace: function (referenceEl) {
referenceEl = resolveEl(referenceEl);
var el = getEl(this, referenceEl);
beforeRemove(referenceEl);
@ -46,7 +46,7 @@ module.exports = function(target, getEl, afterInsert) {
removeChild(referenceEl);
return afterInsert(this, referenceEl);
},
replaceChildrenOf: function(referenceEl) {
replaceChildrenOf: function (referenceEl) {
referenceEl = resolveEl(referenceEl);
var el = getEl(this, referenceEl);
@ -61,13 +61,13 @@ module.exports = function(target, getEl, afterInsert) {
insertBefore(el, null, referenceEl);
return afterInsert(this, referenceEl);
},
insertBefore: function(referenceEl) {
insertBefore: function (referenceEl) {
referenceEl = resolveEl(referenceEl);
var el = getEl(this, referenceEl);
insertBefore(el, referenceEl, referenceEl.parentNode);
return afterInsert(this, referenceEl);
},
insertAfter: function(referenceEl) {
insertAfter: function (referenceEl) {
referenceEl = resolveEl(referenceEl);
var el = getEl(this, referenceEl);
insertAfter(el, referenceEl, referenceEl.parentNode);

View File

@ -6,7 +6,7 @@ var ComponentsContext = require("../components/ComponentsContext");
var getComponentsContext = ComponentsContext.___getComponentsContext;
var ComponentDef = require("../components/ComponentDef");
var w10NOOP = require("warp10/constants").NOOP;
var RENDER_BODY_TO_JSON = function() {
var RENDER_BODY_TO_JSON = function () {
return w10NOOP;
};

View File

@ -1,7 +1,7 @@
"use strict";
module.exports = function loadNestedTagHelper(targetProperty, isRepeated) {
return function(input, parent) {
return function (input, parent) {
// If we are nested tag then we do not have a renderer
if (isRepeated) {
var existingArray = parent[targetProperty];

View File

@ -1,5 +1,5 @@
"use strict";
module.exports = function(value) {
module.exports = function (value) {
return value == null ? "" : value + "";
};

View File

@ -19,10 +19,10 @@ var voidWriter = {
script: noop,
merge: noop,
clear: noop,
get: function() {
get: function () {
return [];
},
toString: function() {
toString: function () {
return "";
}
};
@ -108,7 +108,7 @@ AsyncStream.INCLUDE_STACK =
process.env.NODE_ENV === "development" ||
process.env.NODE_ENV === "dev");
AsyncStream.enableAsyncStackTrace = function() {
AsyncStream.enableAsyncStackTrace = function () {
AsyncStream.INCLUDE_STACK = true;
};
@ -117,49 +117,49 @@ var proto = (AsyncStream.prototype = {
___document: defaultDocument,
___isOut: true,
sync: function() {
sync: function () {
this._sync = true;
},
isSync: function() {
isSync: function () {
return this._sync === true;
},
write: function(str) {
write: function (str) {
if (str != null) {
this.writer.write(str.toString());
}
return this;
},
script: function(str) {
script: function (str) {
if (str != null) {
this.writer.script(str.toString());
}
return this;
},
___getOutput: function() {
___getOutput: function () {
return this._state.writer.toString();
},
/**
* Legacy...
*/
getOutput: function() {
getOutput: function () {
return this.___getOutput();
},
toString: function() {
toString: function () {
return this._state.writer.toString();
},
___getResult: function() {
___getResult: function () {
this._result = this._result || new RenderResult(this);
return this._result;
},
beginAsync: function(options) {
beginAsync: function (options) {
if (this._sync) {
throw new Error("beginAsync() not allowed when using renderSync()");
}
@ -221,7 +221,7 @@ var proto = (AsyncStream.prototype = {
newStream.name = name;
if (timeout > 0) {
newStream._timeoutId = setTimeout(function() {
newStream._timeoutId = setTimeout(function () {
newStream.error(
new Error(
"Async fragment " +
@ -242,7 +242,7 @@ var proto = (AsyncStream.prototype = {
return newStream;
},
_doFinish: function() {
_doFinish: function () {
var state = this._state;
state.finished = true;
@ -254,7 +254,7 @@ var proto = (AsyncStream.prototype = {
}
},
end: function(data) {
end: function (data) {
if (this._ended === true) {
return;
}
@ -311,7 +311,7 @@ var proto = (AsyncStream.prototype = {
return this;
},
_handleChildDone: function() {
_handleChildDone: function () {
var remaining = --this._remaining;
if (remaining === 0) {
@ -326,7 +326,7 @@ var proto = (AsyncStream.prototype = {
}
},
_flushNext: function(currentWriter) {
_flushNext: function (currentWriter) {
// It is possible that currentWriter is the
// last writer in the chain, so let's make
// sure there is a nextWriter to flush.
@ -353,7 +353,7 @@ var proto = (AsyncStream.prototype = {
}
},
on: function(event, callback) {
on: function (event, callback) {
var state = this._state;
if (event === "finish" && state.finished === true) {
@ -367,7 +367,7 @@ var proto = (AsyncStream.prototype = {
return this;
},
once: function(event, callback) {
once: function (event, callback) {
var state = this._state;
if (event === "finish" && state.finished === true) {
@ -381,7 +381,7 @@ var proto = (AsyncStream.prototype = {
return this;
},
onLast: function(callback) {
onLast: function (callback) {
var lastArray = this._last;
if (lastArray === undefined) {
@ -393,7 +393,7 @@ var proto = (AsyncStream.prototype = {
return this;
},
_emitLast: function() {
_emitLast: function () {
var lastArray = this._last;
var i = 0;
@ -413,7 +413,7 @@ var proto = (AsyncStream.prototype = {
next();
},
emit: function(type, arg) {
emit: function (type, arg) {
var events = this._state.events;
switch (arguments.length) {
case 1:
@ -429,24 +429,24 @@ var proto = (AsyncStream.prototype = {
return this;
},
removeListener: function() {
removeListener: function () {
var events = this._state.events;
events.removeListener.apply(events, arguments);
return this;
},
prependListener: function() {
prependListener: function () {
var events = this._state.events;
events.prependListener.apply(events, arguments);
return this;
},
pipe: function(stream) {
pipe: function (stream) {
this._state.stream.pipe(stream);
return this;
},
error: function(e) {
error: function (e) {
var name = this.name;
var stack = this._stack;
@ -473,7 +473,7 @@ var proto = (AsyncStream.prototype = {
return this;
},
flush: function() {
flush: function () {
var state = this._state;
if (!state.finished) {
@ -485,7 +485,7 @@ var proto = (AsyncStream.prototype = {
return this;
},
createOut: function() {
createOut: function () {
var newOut = new AsyncStream(this.global);
// Forward error events to the parent out.
newOut.on("error", this.emit.bind(this, "error"));
@ -496,7 +496,13 @@ var proto = (AsyncStream.prototype = {
return newOut;
},
___elementDynamic: function(tagName, elementAttrs, key, componentDef, props) {
___elementDynamic: function (
tagName,
elementAttrs,
key,
componentDef,
props
) {
var str =
"<" +
tagName +
@ -514,7 +520,7 @@ var proto = (AsyncStream.prototype = {
this.write(str);
},
element: function(tagName, elementAttrs, openTagOnly) {
element: function (tagName, elementAttrs, openTagOnly) {
var str = "<" + tagName + attrsHelper(elementAttrs) + ">";
if (openTagOnly !== true) {
@ -524,7 +530,7 @@ var proto = (AsyncStream.prototype = {
this.write(str);
},
___beginElementDynamic: function(
___beginElementDynamic: function (
name,
elementAttrs,
key,
@ -547,7 +553,7 @@ var proto = (AsyncStream.prototype = {
}
},
beginElement: function(name, elementAttrs) {
beginElement: function (name, elementAttrs) {
var str = "<" + name + attrsHelper(elementAttrs) + ">";
this.write(str);
@ -559,20 +565,20 @@ var proto = (AsyncStream.prototype = {
}
},
endElement: function() {
endElement: function () {
var tagName = this._elStack.pop();
this.write("</" + tagName + ">");
},
comment: function(str) {
comment: function (str) {
this.write("<!--" + escapeEndingComment(str) + "-->");
},
text: function(str) {
text: function (str) {
this.write(escapeXmlOrNullish(str));
},
bf: function(key, component, preserve) {
bf: function (key, component, preserve) {
if (preserve) {
this.write("<!--F#" + escapeXmlString(key) + "-->");
}
@ -583,14 +589,14 @@ var proto = (AsyncStream.prototype = {
}
},
ef: function() {
ef: function () {
var preserve = this._elStack.pop();
if (preserve) {
this.write("<!--F/-->");
}
},
___getNode: function(doc) {
___getNode: function (doc) {
var node = this._node;
var nextEl;
var fragment;
@ -623,11 +629,11 @@ var proto = (AsyncStream.prototype = {
return node;
},
then: function(fn, fnErr) {
then: function (fn, fnErr) {
var out = this;
var promise = new Promise(function(resolve, reject) {
var promise = new Promise(function (resolve, reject) {
out.on("error", reject);
out.on("finish", function(result) {
out.on("finish", function (result) {
resolve(result);
});
});
@ -635,11 +641,11 @@ var proto = (AsyncStream.prototype = {
return Promise.resolve(promise).then(fn, fnErr);
},
catch: function(fnErr) {
catch: function (fnErr) {
return this.then(undefined, fnErr);
},
c: function(componentDef, key, customEvents) {
c: function (componentDef, key, customEvents) {
this.___assignedComponentDef = componentDef;
this.___assignedKey = key;
this.___assignedCustomEvents = customEvents;

View File

@ -22,7 +22,7 @@ BufferedWriter.prototype = Object.assign(
}
},
end: function() {
end: function () {
flush(this);
if (!this._wrapped.isTTY) {
this._wrapped.end();

View File

@ -10,22 +10,22 @@ function StringWriter() {
}
StringWriter.prototype = {
write: function(str) {
write: function (str) {
this._content += str;
},
script: function(str) {
script: function (str) {
if (str) {
this._scripts += (this._scripts ? ";" : "") + str;
}
},
get: function(key) {
get: function (key) {
const extra = (this._data = this._data || {});
return (extra[key] = extra[key] || []);
},
merge: function(otherWriter) {
merge: function (otherWriter) {
this._content += otherWriter._content;
this._scripts += otherWriter._scripts;
if (otherWriter._data) {
@ -43,13 +43,13 @@ StringWriter.prototype = {
}
},
clear: function() {
clear: function () {
this._content = "";
this._scripts = "";
this._data = null;
},
toString: function() {
toString: function () {
this.state.events.emit("___toString", this);
let str = this._content;
if (this._scripts) {

View File

@ -52,7 +52,7 @@ function createOut(globalData, writer, parentOut, buffer) {
Template.prototype = {
createOut: createOut,
stream: function(data) {
stream: function (data) {
return new Readable(this, data, this._options);
}
};

View File

@ -1,6 +1,6 @@
"use strict";
exports.d = function(value) {
exports.d = function (value) {
return escapeDoubleQuotes(value + "", 0);
};

View File

@ -1,6 +1,6 @@
"use strict";
module.exports.x = function(value) {
module.exports.x = function (value) {
if (value == null) {
return "";
}

View File

@ -31,7 +31,7 @@ function createOut(globalData, parent, state, buffer) {
return new AsyncStream(globalData, parent, state, buffer);
}
exports.createWriter = function(writer) {
exports.createWriter = function (writer) {
return new AsyncStream(null, writer);
};

View File

@ -3,12 +3,12 @@ module.exports =
typeof queueMicrotask === "function"
? queueMicrotask
: typeof Promise === "function" && (promise = Promise.resolve())
? function(cb) {
? function (cb) {
promise.then(cb).catch(rethrow);
}
: setTimeout;
function rethrow(err) {
setTimeout(function() {
setTimeout(function () {
throw err;
});
}

View File

@ -11,9 +11,9 @@ function safeRender(renderFunc, finalData, finalOut, shouldEnd) {
}
} catch (err) {
var actualEnd = finalOut.end;
finalOut.end = function() {};
finalOut.end = function () {};
setImmediate(function() {
setImmediate(function () {
finalOut.end = actualEnd;
finalOut.error(err);
});
@ -21,7 +21,7 @@ function safeRender(renderFunc, finalData, finalOut, shouldEnd) {
return finalOut;
}
module.exports = function(target, renderer) {
module.exports = function (target, renderer) {
var renderFunc =
renderer && (renderer.renderer || renderer.render || renderer);
var createOut = target.createOut || renderer.createOut || defaultCreateOut;
@ -29,7 +29,7 @@ module.exports = function(target, renderer) {
return extend(target, {
createOut: createOut,
renderToString: function(data, callback) {
renderToString: function (data, callback) {
var localData = data || {};
var render = renderFunc || this._;
var globalData = localData.$global;
@ -43,7 +43,7 @@ module.exports = function(target, renderer) {
if (callback) {
out
.on("finish", function() {
.on("finish", function () {
callback(null, out.toString(), out);
})
.once("error", callback);
@ -56,7 +56,7 @@ module.exports = function(target, renderer) {
}
},
renderSync: function(data) {
renderSync: function (data) {
var localData = data || {};
var render = renderFunc || this._;
var globalData = localData.$global;
@ -90,7 +90,7 @@ module.exports = function(target, renderer) {
* @param {AsyncStream/AsyncVDOMBuilder} out A Stream, an AsyncStream/AsyncVDOMBuilder instance, or a callback function
* @return {AsyncStream/AsyncVDOMBuilder} Returns the AsyncStream/AsyncVDOMBuilder instance that the template is rendered to
*/
render: function(data, out) {
render: function (data, out) {
var callback;
var finalOut;
var finalData;
@ -126,7 +126,7 @@ module.exports = function(target, renderer) {
if (callback) {
finalOut
.on("finish", function() {
.on("finish", function () {
callback(null, finalOut.___getResult());
})
.once("error", callback);

View File

@ -1,10 +1,10 @@
module.exports =
global.setImmediate ||
(function() {
(function () {
var queue = [];
var win = window;
var msg = "" + Math.random();
win.addEventListener("message", function(ev) {
win.addEventListener("message", function (ev) {
if (ev.data === msg) {
var callbacks = queue;
queue = [];
@ -13,7 +13,7 @@ module.exports =
}
}
});
return function(callback) {
return function (callback) {
if (queue.push(callback) === 1) {
win.postMessage(msg, "*");
}

View File

@ -56,17 +56,17 @@ var proto = (AsyncVDOMBuilder.prototype = {
___isOut: true,
___document: defaultDocument,
bc: function(component, key, ownerComponent) {
bc: function (component, key, ownerComponent) {
var vComponent = new VComponent(component, key, ownerComponent);
return this.___beginNode(vComponent, 0, true);
},
___preserveComponent: function(component, key, ownerComponent) {
___preserveComponent: function (component, key, ownerComponent) {
var vComponent = new VComponent(component, key, ownerComponent, true);
this.___beginNode(vComponent, 0);
},
___beginNode: function(child, childCount, pushToStack) {
___beginNode: function (child, childCount, pushToStack) {
this.___parent.___appendChild(child);
if (pushToStack === true) {
this.___stack.push(child);
@ -75,7 +75,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
return childCount === 0 ? this : child;
},
element: function(tagName, attrs, key, component, childCount, flags, props) {
element: function (tagName, attrs, key, component, childCount, flags, props) {
var element = new VElement(
tagName,
attrs,
@ -88,7 +88,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
return this.___beginNode(element, childCount);
},
___elementDynamic: function(tagName, attrs, key, componentDef, props) {
___elementDynamic: function (tagName, attrs, key, componentDef, props) {
return this.element(
tagName,
attrsHelper(attrs),
@ -100,7 +100,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
);
},
n: function(node, component) {
n: function (node, component) {
// NOTE: We do a shallow clone since we assume the node is being reused
// and a node can only have one parent node.
var clone = node.___cloneNode();
@ -110,12 +110,12 @@ var proto = (AsyncVDOMBuilder.prototype = {
return this;
},
node: function(node) {
node: function (node) {
this.___parent.___appendChild(node);
return this;
},
text: function(text, ownerComponent) {
text: function (text, ownerComponent) {
var type = typeof text;
if (type != "string") {
@ -134,7 +134,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
return this;
},
html: function(html, ownerComponent) {
html: function (html, ownerComponent) {
if (html != null) {
var vdomNode = virtualizeHTML(
html,
@ -147,7 +147,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
return this;
},
beginElement: function(
beginElement: function (
tagName,
attrs,
key,
@ -169,7 +169,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
return this;
},
___beginElementDynamic: function(tagName, attrs, key, componentDef, props) {
___beginElementDynamic: function (tagName, attrs, key, componentDef, props) {
return this.beginElement(
tagName,
attrsHelper(attrs),
@ -181,23 +181,23 @@ var proto = (AsyncVDOMBuilder.prototype = {
);
},
bf: function(key, component, preserve) {
bf: function (key, component, preserve) {
var fragment = new VFragment(key, component, preserve);
this.___beginNode(fragment, null, true);
return this;
},
ef: function() {
ef: function () {
this.endElement();
},
endElement: function() {
endElement: function () {
var stack = this.___stack;
stack.pop();
this.___parent = stack[stack.length - 1];
},
end: function() {
end: function () {
this.___parent = undefined;
var remaining = --this.___remaining;
@ -216,7 +216,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
return this;
},
___handleChildDone: function() {
___handleChildDone: function () {
var remaining = --this.___remaining;
if (remaining === 0) {
@ -231,13 +231,13 @@ var proto = (AsyncVDOMBuilder.prototype = {
}
},
___doFinish: function() {
___doFinish: function () {
var state = this.___state;
state.___finished = true;
state.___events.emit(EVENT_FINISH, this.___getResult());
},
___emitLast: function() {
___emitLast: function () {
var lastArray = this._last;
var i = 0;
@ -257,7 +257,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
next();
},
error: function(e) {
error: function (e) {
try {
this.emit("error", e);
} finally {
@ -271,7 +271,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
return this;
},
beginAsync: function(options) {
beginAsync: function (options) {
if (this.___sync) {
throw Error(
"Tried to render async while in sync mode. Note: Client side await is not currently supported in re-renders (Issue: #942)."
@ -299,11 +299,11 @@ var proto = (AsyncVDOMBuilder.prototype = {
return asyncOut;
},
createOut: function() {
createOut: function () {
return new AsyncVDOMBuilder(this.global);
},
flush: function() {
flush: function () {
var events = this.___state.___events;
if (events.listenerCount(EVENT_UPDATE)) {
@ -311,15 +311,15 @@ var proto = (AsyncVDOMBuilder.prototype = {
}
},
___getOutput: function() {
___getOutput: function () {
return this.___state.___tree;
},
___getResult: function() {
___getResult: function () {
return this.___result || (this.___result = new RenderResult(this));
},
on: function(event, callback) {
on: function (event, callback) {
var state = this.___state;
if (event === EVENT_FINISH && state.___finished) {
@ -333,7 +333,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
return this;
},
once: function(event, callback) {
once: function (event, callback) {
var state = this.___state;
if (event === EVENT_FINISH && state.___finished) {
@ -347,7 +347,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
return this;
},
emit: function(type, arg) {
emit: function (type, arg) {
var events = this.___state.___events;
switch (arguments.length) {
case 1:
@ -363,21 +363,21 @@ var proto = (AsyncVDOMBuilder.prototype = {
return this;
},
removeListener: function() {
removeListener: function () {
var events = this.___state.___events;
events.removeListener.apply(events, arguments);
return this;
},
sync: function() {
sync: function () {
this.___sync = true;
},
isSync: function() {
isSync: function () {
return this.___sync;
},
onLast: function(callback) {
onLast: function (callback) {
var lastArray = this._last;
if (lastArray === undefined) {
@ -389,7 +389,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
return this;
},
___getNode: function(doc) {
___getNode: function (doc) {
var node = this.___vnode;
if (!node) {
var vdomTree = this.___getOutput();
@ -401,7 +401,7 @@ var proto = (AsyncVDOMBuilder.prototype = {
return node;
},
toString: function(doc) {
toString: function (doc) {
var docFragment = this.___getNode(doc);
var html = "";
@ -422,10 +422,10 @@ var proto = (AsyncVDOMBuilder.prototype = {
return html;
},
then: function(fn, fnErr) {
then: function (fn, fnErr) {
var out = this;
var promise = new Promise(function(resolve, reject) {
out.on("error", reject).on(EVENT_FINISH, function(result) {
var promise = new Promise(function (resolve, reject) {
out.on("error", reject).on(EVENT_FINISH, function (result) {
resolve(result);
});
});
@ -433,13 +433,13 @@ var proto = (AsyncVDOMBuilder.prototype = {
return Promise.resolve(promise).then(fn, fnErr);
},
catch: function(fnErr) {
catch: function (fnErr) {
return this.then(undefined, fnErr);
},
isVDOM: true,
c: function(componentDef, key, customEvents) {
c: function (componentDef, key, customEvents) {
this.___assignedComponentDef = componentDef;
this.___assignedKey = key;
this.___assignedCustomEvents = customEvents;

View File

@ -18,11 +18,11 @@ VDocumentFragment.prototype = {
___DocumentFragment: true,
___cloneNode: function() {
___cloneNode: function () {
return new VDocumentFragmentClone(this);
},
___actualize: function(doc) {
___actualize: function (doc) {
return doc.createDocumentFragment();
}
};

View File

@ -107,7 +107,7 @@ function VElement(
VElement.prototype = {
___nodeType: 1,
___cloneNode: function() {
___cloneNode: function () {
return new VElementClone(this);
},
@ -118,7 +118,7 @@ VElement.prototype = {
* @param {int|null} attrCount The number of attributes (or `null` if not known)
* @param {int|null} childCount The number of child nodes (or `null` if not known)
*/
e: function(tagName, attrs, key, ownerComponent, childCount, flags, props) {
e: function (tagName, attrs, key, ownerComponent, childCount, flags, props) {
var child = this.___appendChild(
new VElement(
tagName,
@ -144,14 +144,14 @@ VElement.prototype = {
*
* @param {String} value The value for the new Comment node
*/
n: function(node, ownerComponent) {
n: function (node, ownerComponent) {
node = node.___cloneNode();
node.___ownerComponent = ownerComponent;
this.___appendChild(node);
return this.___finishChild();
},
___actualize: function(doc, parentNamespaceURI) {
___actualize: function (doc, parentNamespaceURI) {
var tagName = this.___nodeName;
var attributes = this.___attributes;
var namespaceURI = DEFAULT_NS[tagName] || parentNamespaceURI || NS_HTML;
@ -192,7 +192,7 @@ VElement.prototype = {
return el;
},
___hasAttribute: function(name) {
___hasAttribute: function (name) {
// We don't care about the namespaces since the there
// is no chance that attributes with the same name will have
// different namespaces
@ -205,9 +205,9 @@ inherit(VElement, VNode);
var proto = (VElementClone.prototype = VElement.prototype);
["checked", "selected", "disabled"].forEach(function(name) {
["checked", "selected", "disabled"].forEach(function (name) {
defineProperty(proto, name, {
get: function() {
get: function () {
var value = this.___attributes[name];
return value !== false && value != null;
}
@ -215,7 +215,7 @@ var proto = (VElementClone.prototype = VElement.prototype);
});
defineProperty(proto, "___value", {
get: function() {
get: function () {
var value = this.___valueInternal;
if (value == null) {
value = this.___attributes.value;
@ -229,7 +229,7 @@ defineProperty(proto, "___value", {
}
});
VElement.___removePreservedAttributes = function(attrs) {
VElement.___removePreservedAttributes = function (attrs) {
// By default this static method is a no-op, but if there are any
// compiled components that have "no-update" attributes then
// `preserve-attrs.js` will be imported and this method will be replaced
@ -288,7 +288,7 @@ function virtualizeElement(node, virtualizeChildNodes, ownerComponent) {
VElement.___virtualize = virtualizeElement;
VElement.___morphAttrs = function(fromEl, vFromEl, toEl) {
VElement.___morphAttrs = function (fromEl, vFromEl, toEl) {
var removePreservedAttributes = VElement.___removePreservedAttributes;
var fromFlags = vFromEl.___flags;

View File

@ -13,7 +13,7 @@ function VFragment(key, ownerComponent, preserve) {
VFragment.prototype = {
___nodeType: 12,
___actualize: function() {
___actualize: function () {
var fragment = createFragmentNode();
keysByDOMNode.set(fragment, this.___key);
vElementByDOMNode.set(fragment, this);

View File

@ -2,7 +2,7 @@
function VNode() {}
VNode.prototype = {
___VNode: function(finalChildCount, ownerComponent) {
___VNode: function (finalChildCount, ownerComponent) {
this.___finalChildCount = finalChildCount;
this.___childCount = 0;
this.___firstChildInternal = null;
@ -45,7 +45,7 @@ VNode.prototype = {
return nextSibling;
},
___appendChild: function(child) {
___appendChild: function (child) {
this.___childCount++;
if (this.___nodeName === "textarea") {

View File

@ -11,11 +11,11 @@ VText.prototype = {
___nodeType: 3,
___actualize: function(doc) {
___actualize: function (doc) {
return doc.createTextNode(this.___nodeValue);
},
___cloneNode: function() {
___cloneNode: function () {
return new VText(this.___nodeValue);
}
};

View File

@ -6,7 +6,7 @@ var styleHelper = require("../../helpers/style-value");
/**
* Helper for processing dynamic attributes
*/
module.exports = function(attributes) {
module.exports = function (attributes) {
if (attributes != null) {
// eslint-disable-next-line no-constant-condition
if ("MARKO_DEBUG") {

View File

@ -1,8 +1,8 @@
"use strict";
module.exports = function(id) {
module.exports = function (id) {
var i = 0;
return function() {
return function () {
return id + i++;
};
};

View File

@ -2,7 +2,7 @@
var VElement = require("../vdom").___VElement;
module.exports = function(
module.exports = function (
tagName,
attrs,
key,

View File

@ -2,6 +2,6 @@
var VText = require("../vdom").___VText;
module.exports = function(value) {
module.exports = function (value) {
return new VText(value);
};

View File

@ -37,7 +37,7 @@ var fragmentPrototype = {
nodes.push(current);
return nodes;
},
insertBefore: function(newChildNode, referenceNode) {
insertBefore: function (newChildNode, referenceNode) {
var actualReference = referenceNode == null ? this.endNode : referenceNode;
return insertBefore(
newChildNode,
@ -45,14 +45,14 @@ var fragmentPrototype = {
this.startNode.parentNode
);
},
insertInto: function(newParentNode, referenceNode) {
this.nodes.forEach(function(node) {
insertInto: function (newParentNode, referenceNode) {
this.nodes.forEach(function (node) {
insertBefore(node, referenceNode, newParentNode);
}, this);
return this;
},
remove: function() {
this.nodes.forEach(function(node) {
remove: function () {
this.nodes.forEach(function (node) {
this.detachedContainer.appendChild(node);
}, this);
}
@ -79,7 +79,7 @@ function createFragmentNode(startNode, nextNode, parentNode) {
function beginFragmentNode(startNode, parentNode) {
var fragment = createFragmentNode(startNode, null, parentNode);
fragment.___finishFragment = function(nextNode) {
fragment.___finishFragment = function (nextNode) {
fragment.___finishFragment = null;
insertBefore(
fragment.endNode,

View File

@ -673,7 +673,7 @@ function morphdom(fromNode, toNode, doc, componentsContext) {
morphChildren(fromNode, toNode, toNode.___component);
detachedNodes.forEach(function(node) {
detachedNodes.forEach(function (node) {
var detachedFromComponent = detachedByDOMNode.get(node);
if (detachedFromComponent !== undefined) {

View File

@ -32,10 +32,10 @@ SpecialElHandlers.prototype = {
* Needed for IE. Apparently IE doesn't think that "selected" is an
* attribute when reading over the attributes using selectEl.attributes
*/
option: function(fromEl, toEl) {
option: function (fromEl, toEl) {
syncBooleanAttrProp(fromEl, toEl, "selected");
},
button: function(fromEl, toEl) {
button: function (fromEl, toEl) {
syncBooleanAttrProp(fromEl, toEl, "disabled");
},
/**
@ -44,7 +44,7 @@ SpecialElHandlers.prototype = {
* "value" property will have no effect since it is only used to the set the
* initial value. Similar for the "checked" attribute, and "disabled".
*/
input: function(fromEl, toEl) {
input: function (fromEl, toEl) {
syncBooleanAttrProp(fromEl, toEl, "checked");
syncBooleanAttrProp(fromEl, toEl, "disabled");
@ -57,7 +57,7 @@ SpecialElHandlers.prototype = {
}
},
textarea: function(fromEl, toEl) {
textarea: function (fromEl, toEl) {
if (toEl.___preserveTextAreaValue) {
return;
}
@ -83,12 +83,12 @@ SpecialElHandlers.prototype = {
firstChild.nodeValue = newValue;
}
},
select: function(fromEl, toEl) {
select: function (fromEl, toEl) {
if (!toEl.___hasAttribute("multiple")) {
var selected = 0;
forEachOption(
toEl,
function(option, i) {
function (option, i) {
if (option.___hasAttribute("selected")) {
selected = i;
}

View File

@ -1,11 +1,11 @@
var parseHTML = function(html) {
var parseHTML = function (html) {
var container = document.createElement("template");
parseHTML = container.content
? function(html) {
? function (html) {
container.innerHTML = html;
return container.content;
}
: function(html) {
: function (html) {
container.innerHTML = html;
return container;
};
@ -13,6 +13,6 @@ var parseHTML = function(html) {
return parseHTML(html);
};
module.exports = function(html) {
module.exports = function (html) {
return parseHTML(html).firstChild;
};

View File

@ -4,7 +4,7 @@ function removePreservedAttributes(attrs, props) {
var preservedAttrs = props && props.pa;
if (preservedAttrs) {
attrs = extend({}, attrs);
preservedAttrs.forEach(function(preservedAttrName) {
preservedAttrs.forEach(function (preservedAttrName) {
delete attrs[preservedAttrName];
});
}

View File

@ -52,7 +52,7 @@ var Node_prototype = VNode.prototype;
* Shorthand method for creating and appending a Text node with a given value
* @param {String} value The text value for the new Text node
*/
Node_prototype.t = function(value) {
Node_prototype.t = function (value) {
var type = typeof value;
var vdomNode;
@ -70,7 +70,7 @@ Node_prototype.t = function(value) {
return this.___finishChild();
};
Node_prototype.___appendDocumentFragment = function() {
Node_prototype.___appendDocumentFragment = function () {
return this.___appendChild(new VDocumentFragment());
};

View File

@ -27,7 +27,7 @@ exports.excludePackage = compiler.taglib.excludePackage;
exports.loader = compiler.taglib._loader;
exports.finder = compiler.taglib._finder;
exports.lookup = {
buildLookup: function(dir, translator) {
buildLookup: function (dir, translator) {
if (!translator || !Array.isArray(translator.taglibs)) {
translator = require("@marko/translator-default");
// eslint-disable-next-line no-constant-condition

View File

@ -10,18 +10,18 @@ function BrowserHelpers() {
}
BrowserHelpers.prototype = {
triggerEvent: function(el, type) {
triggerEvent: function (el, type) {
var ev = document.createEvent("Event");
ev.initEvent(type, true, true);
el.dispatchEvent(ev);
},
triggerCustomEvent: function(el, type, detail) {
triggerCustomEvent: function (el, type, detail) {
var ev = new CustomEvent(type, { detail: detail });
el.dispatchEvent(ev);
},
triggerMouseEvent: function(el, type) {
triggerMouseEvent: function (el, type) {
var ev = document.createEvent("MouseEvent");
ev.initMouseEvent(
type,
@ -43,15 +43,15 @@ BrowserHelpers.prototype = {
el.dispatchEvent(ev);
},
triggerClick: function(el) {
triggerClick: function (el) {
this.triggerMouseEvent(el, "click");
},
triggerMouseMove: function(el) {
triggerMouseMove: function (el) {
this.triggerMouseEvent(el, "mousemove");
},
mount: function(templatePath, input) {
mount: function (templatePath, input) {
var $global = input && input.$global;
var template = require(templatePath);
template = template.default || template;
@ -80,11 +80,11 @@ BrowserHelpers.prototype = {
return instance;
},
log: function(data) {
log: function (data) {
this.logOutput.push(data);
},
getComponentForEl: function(el) {
getComponentForEl: function (el) {
return markoComponents.getComponentForEl(el);
},
@ -92,7 +92,7 @@ BrowserHelpers.prototype = {
return document.getElementById("testsTarget");
},
nodeListToArray: function(nodes) {
nodeListToArray: function (nodes) {
var nodeArray = new Array(nodes.length);
for (var i = 0; i < nodes.length; i++) {
nodeArray[i] = nodes[i];
@ -100,7 +100,7 @@ BrowserHelpers.prototype = {
return nodeArray;
},
checkChildrenMatch: function(children1, children2) {
checkChildrenMatch: function (children1, children2) {
expect(children1.length).to.equal(children2.length);
for (var i = 0; i < children1.length; i++) {
@ -118,7 +118,7 @@ BrowserHelpers.prototype = {
}
},
cleanPath: function(path) {
cleanPath: function (path) {
return path.replace(/\.\d+\.in-context$/, "");
}
};

View File

@ -10,7 +10,7 @@ exports.promiseProvider = async (delay, value) => {
};
exports.callbackProvider = (delay, value) => {
return function(callback) {
return function (callback) {
exports.promiseProvider(delay, value).then(
resolved => callback(null, resolved),
rejected => callback(rejected)
@ -19,7 +19,7 @@ exports.callbackProvider = (delay, value) => {
};
exports.callbackProviderWithArgs = (delay, resolver = x => x) => {
return function(...all) {
return function (...all) {
const args = all.slice(0, all.length - 1);
const callback = all[all.length - 1];
const value = resolver(...args);

View File

@ -4,7 +4,7 @@ module.exports = function addAsyncTestSuites(name, fn) {
// Trick mocha into running the before hook without any tests.
var runner = describe(name, () => {
it(""); // Executes the before even though there are not tests yet.
before(function() {
before(function () {
// Test init can take a while. (This does not change the timeout of the actual tests, just the lasso compile time).
this.timeout(20000);
@ -12,31 +12,31 @@ module.exports = function addAsyncTestSuites(name, fn) {
runner.tests.splice(0, 1);
// patch describe to add to the current suite
var patchedDescribe = (global.describe = function(name, fn) {
var patchedDescribe = (global.describe = function (name, fn) {
return moveSuite(originalDescribe(name, fn), runner);
});
patchedDescribe.only = function(name, fn) {
patchedDescribe.only = function (name, fn) {
return moveSuite(originalDescribe.only(name, fn), runner);
};
patchedDescribe.skip = function(name, fn) {
patchedDescribe.skip = function (name, fn) {
return moveSuite(originalDescribe.skip(name, fn), runner);
};
// patch it to add to the current suite
var patchedIt = (global.it = function(name, fn) {
var patchedIt = (global.it = function (name, fn) {
return moveTest(originalIt(name, fn), runner);
});
patchedIt.only = function(name, fn) {
patchedIt.only = function (name, fn) {
return moveTest(originalIt.only(name, fn), runner);
};
patchedIt.skip = function(name, fn) {
patchedIt.skip = function (name, fn) {
return moveTest(originalIt.skip(name, fn), runner);
};
return fn();
});
after(function() {
after(function () {
// restore the previous describe
global.describe = originalDescribe;
});

View File

@ -19,7 +19,7 @@ const browserExtensions = {
".html": compileMarkoModule
};
module.exports = function(dir, html, options) {
module.exports = function (dir, html, options) {
options = options || {};
return createBrowser({
dir: dir,
@ -31,7 +31,7 @@ module.exports = function(dir, html, options) {
window.alert = () => {};
browser.require("complain").log = (...args) =>
require("complain").log(...args);
globals.forEach(function(k) {
globals.forEach(function (k) {
window[k] = global[k];
});
if (options.beforeParse) {

View File

@ -23,7 +23,7 @@ var openTagOnly = {};
"source",
"track",
"wbr"
].forEach(function(tagName) {
].forEach(function (tagName) {
openTagOnly[tagName] = true;
});

View File

@ -23,7 +23,7 @@ try {
// ignore error
}
Module._resolveFilename = function(request, parent, isMain) {
Module._resolveFilename = function (request, parent, isMain) {
if (request.charAt(0) !== "." && parent.filename.startsWith(rootDir)) {
if (
request === "marko/components" ||

View File

@ -4,6 +4,6 @@ var channels = {};
module.exports = exports = new EventEmitter();
exports.channel = function(name) {
exports.channel = function (name) {
return channels[name] || (channels[name] = new EventEmitter());
};

View File

@ -1,6 +1,6 @@
var path = require("path");
exports.check = function(marko, markoCompiler, expect, snapshot, done) {
exports.check = function (marko, markoCompiler, expect, snapshot, done) {
var compiler = require("marko/compiler");
var templatePath = path.join(__dirname, "template.marko");
@ -9,7 +9,7 @@ exports.check = function(marko, markoCompiler, expect, snapshot, done) {
{
writeVersionComment: false
},
function(err, compiledTemplate) {
function (err, compiledTemplate) {
var code = compiledTemplate.code;
code = code.replace(/marko\/dist\//g, "marko/src/");
snapshot(code, ".js");

View File

@ -1,6 +1,6 @@
var path = require("path");
exports.check = function(marko, markoCompiler, expect, snapshot, done) {
exports.check = function (marko, markoCompiler, expect, snapshot, done) {
var compiler = require("marko/compiler");
var templatePath = path.join(__dirname, "template.marko");

View File

@ -1,7 +1,7 @@
var fs = require("fs");
var path = require("path");
exports.check = function(marko, markoCompiler, expect, snapshot, done) {
exports.check = function (marko, markoCompiler, expect, snapshot, done) {
var compiler = require("marko/compiler");
var templatePath = path.join(__dirname, "template.marko");
@ -13,7 +13,7 @@ exports.check = function(marko, markoCompiler, expect, snapshot, done) {
{
writeVersionComment: false
},
function(err, compiledTemplate) {
function (err, compiledTemplate) {
var code = compiledTemplate.code;
code = code.replace(/marko\/dist\//g, "marko/src/");
snapshot(code, ".js");

View File

@ -6,7 +6,7 @@ function getMarkoVersionComment() {
return "Compiled using marko@" + markoVersion + " - DO NOT EDIT";
}
exports.check = function(marko, markoCompiler, expect, helpers, done) {
exports.check = function (marko, markoCompiler, expect, helpers, done) {
var compiler = require("marko/compiler");
var templatePath = path.join(__dirname, "template.marko");

View File

@ -1,7 +1,7 @@
var fs = require("fs");
var path = require("path");
exports.check = function(marko, markoCompiler, expect, snapshot, done) {
exports.check = function (marko, markoCompiler, expect, snapshot, done) {
var compiler = require("marko/compiler");
var templatePath = path.join(__dirname, "template.marko");

View File

@ -1,4 +1,4 @@
exports.check = function(marko, markoCompiler, expect, helpers, done) {
exports.check = function (marko, markoCompiler, expect, helpers, done) {
var configModulePath = require.resolve("marko/compiler/config");
var config = require(configModulePath);

View File

@ -1,4 +1,4 @@
exports.check = function(marko, markoCompiler, expect, helpers, done) {
exports.check = function (marko, markoCompiler, expect, helpers, done) {
var compiler = require("marko/compiler");
compiler.configure(); // Use defaults
expect(compiler.config.writeVersionComment).to.equal(true);

View File

@ -2,7 +2,7 @@ var nodePath = require("path");
var promiseProvider = require("../../../__util__/async-helpers")
.promiseProvider;
exports.check = function(marko, markoCompiler, expect, helpers, done) {
exports.check = function (marko, markoCompiler, expect, helpers, done) {
var template = marko.load(nodePath.join(__dirname, "template.marko"));
var output;
var e;

View File

@ -1,6 +1,6 @@
var nodePath = require("path");
exports.check = function(marko, markoCompiler, expect, helpers, done) {
exports.check = function (marko, markoCompiler, expect, helpers, done) {
var template = marko.load(nodePath.join(__dirname, "template.marko"));
var output;
var e;

View File

@ -1,12 +1,12 @@
var nodePath = require("path");
exports.check = function(marko, markoCompiler, expect, snapshot, done) {
exports.check = function (marko, markoCompiler, expect, snapshot, done) {
var template = marko.load(nodePath.join(__dirname, "template.marko"));
template.renderToString(
{
name: "John"
},
function(err, html) {
function (err, html) {
if (err) {
return done(err);
}

View File

@ -2,7 +2,7 @@
const nodePath = require("path");
exports.check = function(marko, markoCompiler, expect, snapshot, done) {
exports.check = function (marko, markoCompiler, expect, snapshot, done) {
let template = marko.load(nodePath.join(__dirname, "template.marko"));
template

View File

@ -1,6 +1,6 @@
var nodePath = require("path");
exports.check = function(marko, markoCompiler, expect, snapshot, done) {
exports.check = function (marko, markoCompiler, expect, snapshot, done) {
var template;
var templatePath;

View File

@ -1,7 +1,7 @@
var nodePath = require("path");
var through = require("through");
exports.check = function(marko, markoCompiler, expect, snapshot, done) {
exports.check = function (marko, markoCompiler, expect, snapshot, done) {
var output = "";
var stream = through(function write(data) {
@ -12,11 +12,11 @@ exports.check = function(marko, markoCompiler, expect, snapshot, done) {
var out = runtimeHtml.createWriter(stream);
out
.on("end", function() {
.on("end", function () {
snapshot(output);
done();
})
.on("error", function(e) {
.on("error", function (e) {
done(e);
});

Some files were not shown because too many files have changed in this diff Show More