From 595a5bc594cabfd4971389c23c977687637d4057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kol=C3=A1rik?= Date: Tue, 7 Apr 2015 15:37:15 +0200 Subject: [PATCH] Remove .gobble and .gobble-build from the repo --- .gobble-build/01-babel/.cache/amd-loader.js | 181 ---- .gobble-build/01-babel/.cache/build.js | 48 - .gobble-build/01-babel/.cache/load.js | 19 - .gobble-build/01-babel/.cache/minifycss.js | 7 - .gobble-build/01-babel/.cache/rvc.js | 17 - .gobble-build/01-babel/.cache/tosource.js | 56 -- .gobble-build/01-babel/1/amd-loader.js | 1 - .gobble-build/01-babel/1/build.js | 1 - .gobble-build/01-babel/1/load.js | 1 - .gobble-build/01-babel/1/minifycss.js | 1 - .gobble-build/01-babel/1/rvc.js | 1 - .gobble-build/01-babel/1/tosource.js | 1 - .gobble-build/02-esperantoBundle/1/rvc.js | 926 -------------------- .gobble/01-babel/.cache/amd-loader.js | 181 ---- .gobble/01-babel/.cache/build.js | 48 - .gobble/01-babel/.cache/load.js | 19 - .gobble/01-babel/.cache/minifycss.js | 7 - .gobble/01-babel/.cache/rvc.js | 17 - .gobble/01-babel/.cache/tosource.js | 56 -- .gobble/01-babel/1/amd-loader.js | 1 - .gobble/01-babel/1/build.js | 1 - .gobble/01-babel/1/load.js | 1 - .gobble/01-babel/1/minifycss.js | 1 - .gobble/01-babel/1/rvc.js | 1 - .gobble/01-babel/1/tosource.js | 1 - .gobble/02-esperantoBundle/1/rvc.js | 926 -------------------- 26 files changed, 2520 deletions(-) delete mode 100644 .gobble-build/01-babel/.cache/amd-loader.js delete mode 100644 .gobble-build/01-babel/.cache/build.js delete mode 100644 .gobble-build/01-babel/.cache/load.js delete mode 100644 .gobble-build/01-babel/.cache/minifycss.js delete mode 100644 .gobble-build/01-babel/.cache/rvc.js delete mode 100644 .gobble-build/01-babel/.cache/tosource.js delete mode 120000 .gobble-build/01-babel/1/amd-loader.js delete mode 120000 .gobble-build/01-babel/1/build.js delete mode 120000 .gobble-build/01-babel/1/load.js delete mode 120000 .gobble-build/01-babel/1/minifycss.js delete mode 120000 .gobble-build/01-babel/1/rvc.js delete mode 120000 .gobble-build/01-babel/1/tosource.js delete mode 100644 .gobble-build/02-esperantoBundle/1/rvc.js delete mode 100644 .gobble/01-babel/.cache/amd-loader.js delete mode 100644 .gobble/01-babel/.cache/build.js delete mode 100644 .gobble/01-babel/.cache/load.js delete mode 100644 .gobble/01-babel/.cache/minifycss.js delete mode 100644 .gobble/01-babel/.cache/rvc.js delete mode 100644 .gobble/01-babel/.cache/tosource.js delete mode 120000 .gobble/01-babel/1/amd-loader.js delete mode 120000 .gobble/01-babel/1/build.js delete mode 120000 .gobble/01-babel/1/load.js delete mode 120000 .gobble/01-babel/1/minifycss.js delete mode 120000 .gobble/01-babel/1/rvc.js delete mode 120000 .gobble/01-babel/1/tosource.js delete mode 100644 .gobble/02-esperantoBundle/1/rvc.js diff --git a/.gobble-build/01-babel/.cache/amd-loader.js b/.gobble-build/01-babel/.cache/amd-loader.js deleted file mode 100644 index 9625b55..0000000 --- a/.gobble-build/01-babel/.cache/amd-loader.js +++ /dev/null @@ -1,181 +0,0 @@ -/* - amd-loader - Adapted from https://github.com/guybedford/amd-loader by Guy Bedford - MIT License: https://github.com/guybedford/amd-loader/blob/master/LICENSE -*/ - -var loader = function (pluginId, ext, allowExts, compile) { - if (arguments.length == 3) { - compile = allowExts; - allowExts = undefined; - } else if (arguments.length == 2) { - compile = ext; - ext = allowExts = undefined; - } - - return { - buildCache: {}, - load: function (name, req, load, config) { - var path = req.toUrl(name); - var queryString = ""; - if (path.indexOf("?") != -1) { - queryString = path.substr(path.indexOf("?")); - path = path.substr(0, path.length - queryString.length); - } - - // precompiled -> load from .ext.js extension - if (config.precompiled instanceof Array) { - for (var i = 0; i < config.precompiled.length; i++) if (path.substr(0, config.precompiled[i].length) == config.precompiled[i]) return require([path + "." + pluginId + ".js" + queryString], load, load.error); - } else if (config.precompiled === true) return require([path + "." + pluginId + ".js" + queryString], load, load.error); - - // only add extension if a moduleID not a path - if (ext && name.substr(0, 1) != "/" && !name.match(/:\/\//)) { - var validExt = false; - if (allowExts) { - for (var i = 0; i < allowExts.length; i++) { - if (name.substr(name.length - allowExts[i].length - 1) == "." + allowExts[i]) validExt = true; - } - } - if (!validExt) path += "." + ext + queryString;else path += queryString; - } else { - path += queryString; - } - - var self = this; - - loader.fetch(path, function (source) { - compile(name, source, req, function (compiled) { - if (typeof compiled == "string") { - if (config.isBuild) self.buildCache[name] = compiled; - load.fromText(compiled); - } else load(compiled); - }, load.error, config); - }, load.error); - }, - write: function (pluginName, moduleName, write) { - var compiled = this.buildCache[moduleName]; - if (compiled) write.asModule(pluginName + "!" + moduleName, compiled); - }, - writeFile: function (pluginName, name, req, write) { - write.asModule(pluginName + "!" + name, req.toUrl(name + "." + pluginId + ".js"), this.buildCache[name]); - } - }; -}; - -//loader.load = function(name, req, load, config) { -// load(loader); -//} - -if (typeof window != "undefined") { - var progIds = ["Msxml2.XMLHTTP", "Microsoft.XMLHTTP", "Msxml2.XMLHTTP.4.0"]; - var getXhr = function (path) { - // check if same domain - var sameDomain = true, - domainCheck = /^(\w+:)?\/\/([^\/]+)/.exec(path); - if (typeof window != "undefined" && domainCheck) { - sameDomain = domainCheck[2] === window.location.host; - if (domainCheck[1]) sameDomain &= domainCheck[1] === window.location.protocol; - } - - // create xhr - var xhr; - if (typeof XMLHttpRequest !== "undefined") xhr = new XMLHttpRequest();else { - var progId; - for (var i = 0; i < 3; i += 1) { - progId = progIds[i]; - try { - xhr = new ActiveXObject(progId); - } catch (e) {} - - if (xhr) { - progIds = [progId]; // so faster next time - break; - } - } - } - - // use cors if necessary - if (!sameDomain) { - if (typeof XDomainRequest != "undefined") xhr = new XDomainRequest();else if (!("withCredentials" in xhr)) throw new Error("getXhr(): Cross Origin XHR not supported."); - } - - if (!xhr) throw new Error("getXhr(): XMLHttpRequest not available"); - - return xhr; - }; - - loader.fetch = function (url, callback, errback) { - // get the xhr with CORS enabled if cross domain - var xhr = getXhr(url); - - xhr.open("GET", url, !requirejs.inlineRequire); - xhr.onreadystatechange = function (evt) { - var status, err; - //Do not explicitly handle errors, those should be - //visible via console output in the browser. - if (xhr.readyState === 4) { - status = xhr.status; - if (status > 399 && status < 600) { - err = new Error(url + " HTTP status: " + status); - err.xhr = xhr; - if (errback) errback(err); - } else { - if (xhr.responseText == "") return errback(new Error(url + " empty response")); - callback(xhr.responseText); - } - } - }; - xhr.send(null); - }; -} else if (typeof process !== "undefined" && process.versions && !!process.versions.node) { - var fs = requirejs.nodeRequire("fs"); - loader.fetch = function (path, callback) { - callback(fs.readFileSync(path, "utf8")); - }; -} else if (typeof Packages !== "undefined") { - loader.fetch = function (path, callback, errback) { - var stringBuffer, - line, - encoding = "utf-8", - file = new java.io.File(path), - lineSeparator = java.lang.System.getProperty("line.separator"), - input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file), encoding)), - content = ""; - try { - stringBuffer = new java.lang.StringBuffer(); - line = input.readLine(); - - // Byte Order Mark (BOM) - The Unicode Standard, version 3.0, page 324 - // http://www.unicode.org/faq/utf_bom.html - - // Note that when we use utf-8, the BOM should appear as 'EF BB BF', but it doesn't due to this bug in the JDK: - // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058 - if (line && line.length() && line.charAt(0) === 65279) { - // Eat the BOM, since we've already found the encoding on this file, - // and we plan to concatenating this buffer with others; the BOM should - // only appear at the top of a file. - line = line.substring(1); - } - - stringBuffer.append(line); - - while ((line = input.readLine()) !== null) { - stringBuffer.append(lineSeparator); - stringBuffer.append(line); - } - //Make sure we return a JavaScript string and not a Java string. - content = String(stringBuffer.toString()); //String - } catch (err) { - if (errback) errback(err); - } finally { - input.close(); - } - callback(content); - }; -} else { - loader.fetch = function () { - throw new Error("Environment unsupported."); - }; -} - -export default loader; \ No newline at end of file diff --git a/.gobble-build/01-babel/.cache/build.js b/.gobble-build/01-babel/.cache/build.js deleted file mode 100644 index ecedec0..0000000 --- a/.gobble-build/01-babel/.cache/build.js +++ /dev/null @@ -1,48 +0,0 @@ - - -export default build; -import rcu from "rcu"; -import toSource from "./tosource"; -import minifycss from "./minifycss"; -function build(name, source, callback) { - var definition = rcu.parse(source); - var dependencies = ["require", "ractive"]; - var dependencyArgs = ["require", "Ractive"]; - var importMap = []; - - // Add dependencies from tags, i.e. sub-components - definition.imports.forEach(function (toImport, i) { - var href = toImport.href; - var name = toImport.name; - - var argumentName = "_import_" + i; - - dependencies.push("rvc!" + href.replace(/\.html$/, "")); - dependencyArgs.push(argumentName); - - importMap.push("\"" + name + "\": " + argumentName); - }); - - // Add dependencies from inline require() calls - dependencies = dependencies.concat(definition.modules); - - var options = ["template: " + toSource(definition.template, null, "", "")]; - - if (definition.css) { - options.push("css: " + JSON.stringify(minifycss(definition.css))); - } - - if (definition.imports.length) { - options.push("components: {" + importMap.join(",") + "}"); - } - - var builtModule = "define(\"rvc!" + name + "\", " + JSON.stringify(dependencies) + ",function(" + dependencyArgs.join(",") + "){\n\tvar __options__ = {\n\t\t" + options.join(",\n\t\t") + "\n\t},\n\tcomponent = {};"; - - if (definition.script) { - builtModule += "\n" + definition.script + "\n\tif ( typeof component.exports === \"object\" ) {\n\t\tfor ( var __prop__ in component.exports ) {\n\t\t\tif ( component.exports.hasOwnProperty(__prop__) ) {\n\t\t\t\t__options__[__prop__] = component.exports[__prop__];\n\t\t\t}\n\t\t}\n\t}\n"; - } - - builtModule += "return Ractive.extend(__options__);\n});"; - - callback(builtModule); -} \ No newline at end of file diff --git a/.gobble-build/01-babel/.cache/load.js b/.gobble-build/01-babel/.cache/load.js deleted file mode 100644 index 9986910..0000000 --- a/.gobble-build/01-babel/.cache/load.js +++ /dev/null @@ -1,19 +0,0 @@ - - -export default load; -import rcu from "rcu"; -function load(base, req, source, callback, errback) { - rcu.make(source, { - url: "" + base + ".html", - loadImport: function (name, path, baseUrl, callback) { - path = rcu.resolve(path, base); - req(["rvc!" + path.replace(/\.html$/, "")], callback); - }, - loadModule: function (name, path, baseUrl, callback) { - req([path], callback); - }, - require: function (name) { - return req(name); - } - }, callback, errback); -} \ No newline at end of file diff --git a/.gobble-build/01-babel/.cache/minifycss.js b/.gobble-build/01-babel/.cache/minifycss.js deleted file mode 100644 index f6a5570..0000000 --- a/.gobble-build/01-babel/.cache/minifycss.js +++ /dev/null @@ -1,7 +0,0 @@ -// TODO more intelligent minification? removing comments? -// collapsing declarations? -export default minifycss; - -function minifycss(css) { - return css.replace(/^\s+/gm, ""); -} \ No newline at end of file diff --git a/.gobble-build/01-babel/.cache/rvc.js b/.gobble-build/01-babel/.cache/rvc.js deleted file mode 100644 index b49875f..0000000 --- a/.gobble-build/01-babel/.cache/rvc.js +++ /dev/null @@ -1,17 +0,0 @@ -import Ractive from "ractive"; -import amdLoader from "./amd-loader"; -import rcu from "rcu"; -import load from "./load"; -import build from "./build"; - -rcu.init(Ractive); - -var rvc = amdLoader("rvc", "html", function (name, source, req, callback, errback, config) { - if (config.isBuild) { - build(name, source, callback, errback); - } else { - load(name, req, source, callback, errback); - } -}); - -export default rvc; \ No newline at end of file diff --git a/.gobble-build/01-babel/.cache/tosource.js b/.gobble-build/01-babel/.cache/tosource.js deleted file mode 100644 index ceab653..0000000 --- a/.gobble-build/01-babel/.cache/tosource.js +++ /dev/null @@ -1,56 +0,0 @@ -/* - toSource - Adapted from https://github.com/marcello3d/node-tosource by Marcello Bastéa-Forte - zlib license: https://github.com/marcello3d/node-tosource/blob/master/LICENSE -*/ - -export default toSource; - -function toSource(object, filter, indent, startingIndent) { - var seen = []; - return walk(object, filter, indent === undefined ? " " : indent || "", startingIndent || "", seen); - - function walk(object, filter, indent, currentIndent, seen) { - var nextIndent = currentIndent + indent; - object = filter ? filter(object) : object; - - switch (typeof object) { - case "string": - return JSON.stringify(object); - case "boolean": - case "number": - case "undefined": - return "" + object; - case "function": - return object.toString(); - } - - if (object === null) return "null"; - if (object instanceof RegExp) return object.toString(); - if (object instanceof Date) return "new Date(" + object.getTime() + ")"; - - var seenIndex = seen.indexOf(object) + 1; - if (seenIndex > 0) return "{$circularReference:" + seenIndex + "}"; - seen.push(object); - - function join(elements) { - return indent.slice(1) + elements.join("," + (indent && "\n") + nextIndent) + (indent ? " " : ""); - } - - if (Array.isArray(object)) { - return "[" + join(object.map(function (element) { - return walk(element, filter, indent, nextIndent, seen.slice()); - })) + "]"; - } - var keys = Object.keys(object); - return keys.length ? "{" + join(keys.map(function (key) { - return (legalKey(key) ? key : JSON.stringify(key)) + ":" + walk(object[key], filter, indent, nextIndent, seen.slice()); - })) + "}" : "{}"; - } -} - -var KEYWORD_REGEXP = /^(abstract|boolean|break|byte|case|catch|char|class|const|continue|debugger|default|delete|do|double|else|enum|export|extends|false|final|finally|float|for|function|goto|if|implements|import|in|instanceof|int|interface|long|native|new|null|package|private|protected|public|return|short|static|super|switch|synchronized|this|throw|throws|transient|true|try|typeof|undefined|var|void|volatile|while|with)$/; - -function legalKey(string) { - return /^[a-z_$][0-9a-z_$]*$/gi.test(string) && !KEYWORD_REGEXP.test(string); -} \ No newline at end of file diff --git a/.gobble-build/01-babel/1/amd-loader.js b/.gobble-build/01-babel/1/amd-loader.js deleted file mode 120000 index 3f2f66c..0000000 --- a/.gobble-build/01-babel/1/amd-loader.js +++ /dev/null @@ -1 +0,0 @@ -/www/RACTIVE/components/rvc/.gobble-build/01-babel/.cache/amd-loader.js \ No newline at end of file diff --git a/.gobble-build/01-babel/1/build.js b/.gobble-build/01-babel/1/build.js deleted file mode 120000 index 39fbeee..0000000 --- a/.gobble-build/01-babel/1/build.js +++ /dev/null @@ -1 +0,0 @@ -/www/RACTIVE/components/rvc/.gobble-build/01-babel/.cache/build.js \ No newline at end of file diff --git a/.gobble-build/01-babel/1/load.js b/.gobble-build/01-babel/1/load.js deleted file mode 120000 index f42065a..0000000 --- a/.gobble-build/01-babel/1/load.js +++ /dev/null @@ -1 +0,0 @@ -/www/RACTIVE/components/rvc/.gobble-build/01-babel/.cache/load.js \ No newline at end of file diff --git a/.gobble-build/01-babel/1/minifycss.js b/.gobble-build/01-babel/1/minifycss.js deleted file mode 120000 index d6fe079..0000000 --- a/.gobble-build/01-babel/1/minifycss.js +++ /dev/null @@ -1 +0,0 @@ -/www/RACTIVE/components/rvc/.gobble-build/01-babel/.cache/minifycss.js \ No newline at end of file diff --git a/.gobble-build/01-babel/1/rvc.js b/.gobble-build/01-babel/1/rvc.js deleted file mode 120000 index 19067a1..0000000 --- a/.gobble-build/01-babel/1/rvc.js +++ /dev/null @@ -1 +0,0 @@ -/www/RACTIVE/components/rvc/.gobble-build/01-babel/.cache/rvc.js \ No newline at end of file diff --git a/.gobble-build/01-babel/1/tosource.js b/.gobble-build/01-babel/1/tosource.js deleted file mode 120000 index c2349cb..0000000 --- a/.gobble-build/01-babel/1/tosource.js +++ /dev/null @@ -1 +0,0 @@ -/www/RACTIVE/components/rvc/.gobble-build/01-babel/.cache/tosource.js \ No newline at end of file diff --git a/.gobble-build/02-esperantoBundle/1/rvc.js b/.gobble-build/02-esperantoBundle/1/rvc.js deleted file mode 100644 index 7944e67..0000000 --- a/.gobble-build/02-esperantoBundle/1/rvc.js +++ /dev/null @@ -1,926 +0,0 @@ -define(['ractive'], function (Ractive) { - - 'use strict'; - - /* - amd-loader - Adapted from https://github.com/guybedford/amd-loader by Guy Bedford - MIT License: https://github.com/guybedford/amd-loader/blob/master/LICENSE - */ - - var loader = function (pluginId, ext, allowExts, compile) { - if (arguments.length == 3) { - compile = allowExts; - allowExts = undefined; - } else if (arguments.length == 2) { - compile = ext; - ext = allowExts = undefined; - } - - return { - buildCache: {}, - load: function (name, req, load, config) { - var path = req.toUrl(name); - var queryString = ""; - if (path.indexOf("?") != -1) { - queryString = path.substr(path.indexOf("?")); - path = path.substr(0, path.length - queryString.length); - } - - // precompiled -> load from .ext.js extension - if (config.precompiled instanceof Array) { - for (var i = 0; i < config.precompiled.length; i++) if (path.substr(0, config.precompiled[i].length) == config.precompiled[i]) return require([path + "." + pluginId + ".js" + queryString], load, load.error); - } else if (config.precompiled === true) return require([path + "." + pluginId + ".js" + queryString], load, load.error); - - // only add extension if a moduleID not a path - if (ext && name.substr(0, 1) != "/" && !name.match(/:\/\//)) { - var validExt = false; - if (allowExts) { - for (var i = 0; i < allowExts.length; i++) { - if (name.substr(name.length - allowExts[i].length - 1) == "." + allowExts[i]) validExt = true; - } - } - if (!validExt) path += "." + ext + queryString;else path += queryString; - } else { - path += queryString; - } - - var self = this; - - loader.fetch(path, function (source) { - compile(name, source, req, function (compiled) { - if (typeof compiled == "string") { - if (config.isBuild) self.buildCache[name] = compiled; - load.fromText(compiled); - } else load(compiled); - }, load.error, config); - }, load.error); - }, - write: function (pluginName, moduleName, write) { - var compiled = this.buildCache[moduleName]; - if (compiled) write.asModule(pluginName + "!" + moduleName, compiled); - }, - writeFile: function (pluginName, name, req, write) { - write.asModule(pluginName + "!" + name, req.toUrl(name + "." + pluginId + ".js"), this.buildCache[name]); - } - }; - }; - - //loader.load = function(name, req, load, config) { - // load(loader); - //} - - if (typeof window != "undefined") { - var progIds = ["Msxml2.XMLHTTP", "Microsoft.XMLHTTP", "Msxml2.XMLHTTP.4.0"]; - var getXhr = function (path) { - // check if same domain - var sameDomain = true, - domainCheck = /^(\w+:)?\/\/([^\/]+)/.exec(path); - if (typeof window != "undefined" && domainCheck) { - sameDomain = domainCheck[2] === window.location.host; - if (domainCheck[1]) sameDomain &= domainCheck[1] === window.location.protocol; - } - - // create xhr - var xhr; - if (typeof XMLHttpRequest !== "undefined") xhr = new XMLHttpRequest();else { - var progId; - for (var i = 0; i < 3; i += 1) { - progId = progIds[i]; - try { - xhr = new ActiveXObject(progId); - } catch (e) {} - - if (xhr) { - progIds = [progId]; // so faster next time - break; - } - } - } - - // use cors if necessary - if (!sameDomain) { - if (typeof XDomainRequest != "undefined") xhr = new XDomainRequest();else if (!("withCredentials" in xhr)) throw new Error("getXhr(): Cross Origin XHR not supported."); - } - - if (!xhr) throw new Error("getXhr(): XMLHttpRequest not available"); - - return xhr; - }; - - loader.fetch = function (url, callback, errback) { - // get the xhr with CORS enabled if cross domain - var xhr = getXhr(url); - - xhr.open("GET", url, !requirejs.inlineRequire); - xhr.onreadystatechange = function (evt) { - var status, err; - //Do not explicitly handle errors, those should be - //visible via console output in the browser. - if (xhr.readyState === 4) { - status = xhr.status; - if (status > 399 && status < 600) { - err = new Error(url + " HTTP status: " + status); - err.xhr = xhr; - if (errback) errback(err); - } else { - if (xhr.responseText == "") return errback(new Error(url + " empty response")); - callback(xhr.responseText); - } - } - }; - xhr.send(null); - }; - } else if (typeof process !== "undefined" && process.versions && !!process.versions.node) { - var fs = requirejs.nodeRequire("fs"); - loader.fetch = function (path, callback) { - callback(fs.readFileSync(path, "utf8")); - }; - } else if (typeof Packages !== "undefined") { - loader.fetch = function (path, callback, errback) { - var stringBuffer, - line, - encoding = "utf-8", - file = new java.io.File(path), - lineSeparator = java.lang.System.getProperty("line.separator"), - input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file), encoding)), - content = ""; - try { - stringBuffer = new java.lang.StringBuffer(); - line = input.readLine(); - - // Byte Order Mark (BOM) - The Unicode Standard, version 3.0, page 324 - // http://www.unicode.org/faq/utf_bom.html - - // Note that when we use utf-8, the BOM should appear as 'EF BB BF', but it doesn't due to this bug in the JDK: - // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058 - if (line && line.length() && line.charAt(0) === 65279) { - // Eat the BOM, since we've already found the encoding on this file, - // and we plan to concatenating this buffer with others; the BOM should - // only appear at the top of a file. - line = line.substring(1); - } - - stringBuffer.append(line); - - while ((line = input.readLine()) !== null) { - stringBuffer.append(lineSeparator); - stringBuffer.append(line); - } - //Make sure we return a JavaScript string and not a Java string. - content = String(stringBuffer.toString()); //String - } catch (err) { - if (errback) errback(err); - } finally { - input.close(); - } - callback(content); - }; - } else { - loader.fetch = function () { - throw new Error("Environment unsupported."); - }; - } - - var amdLoader = loader; - - function getName(path) { - var pathParts, filename, lastIndex; - - pathParts = path.split("/"); - filename = pathParts.pop(); - - lastIndex = filename.lastIndexOf("."); - if (lastIndex !== -1) { - filename = filename.substr(0, lastIndex); - } - - return filename; - } - - /** - * Finds the line and column position of character `char` - in a (presumably) multi-line string - * @param {array} lines - an array of strings, each representing - a line of the original string - * @param {number} char - the character index to convert - * @returns {object} - * @property {number} line - the zero-based line index - * @property {number} column - the zero-based column index - * @property {number} char - the character index that was passed in - */ - - - function getLinePosition(lines, char) { - var lineEnds, - line = 0, - lineStart = 0, - column; - - lineEnds = lines.map(function (line) { - var lineEnd = lineStart + line.length + 1; // +1 for the newline - - lineStart = lineEnd; - return lineEnd; - }); - - while (char >= lineEnds[line]) { - lineStart = lineEnds[line]; - line += 1; - } - - column = char - lineStart; - return { line: line, column: column, char: char }; - } - - var requirePattern = /require\s*\(\s*(?:"([^"]+)"|'([^']+)')\s*\)/g; - var TEMPLATE_VERSION = 3; - function parse(source) { - var parsed, template, links, imports, scriptItem, script, styles, match, modules, i, item, result; - - if (!rcu.Ractive) { - throw new Error("rcu has not been initialised! You must call rcu.init(Ractive) before rcu.parse()"); - } - - parsed = rcu.Ractive.parse(source, { - noStringify: true, - interpolate: { script: false, style: false }, - includeLinePositions: true - }); - - if (parsed.v !== TEMPLATE_VERSION) { - throw new Error("Mismatched template version (expected " + TEMPLATE_VERSION + ", got " + parsed.v + ")! Please ensure you are using the latest version of Ractive.js in your build process as well as in your app"); - } - - links = []; - styles = []; - modules = []; - - // Extract certain top-level nodes from the template. We work backwards - // so that we can easily splice them out as we go - template = parsed.t; - i = template.length; - while (i--) { - item = template[i]; - - if (item && item.t === 7) { - if (item.e === "link" && (item.a && item.a.rel === "ractive")) { - links.push(template.splice(i, 1)[0]); - } - - if (item.e === "script" && (!item.a || !item.a.type || item.a.type === "text/javascript")) { - if (scriptItem) { - throw new Error("You can only have one