reintroduce unicode oddities

pull/2958/head
James Garbutt 6 years ago
parent 1ea7dd1253
commit c3b5bca33f

@ -398,7 +398,7 @@ export default class Component {
this.source
);
const parts = module.split('✂]');
const parts = module.split(']');
const final_chunk = parts.pop();
const compiled = new Bundle({ separator: '' });
@ -411,7 +411,7 @@ export default class Component {
const { filename } = compile_options;
// special case — the source file doesn't actually get used anywhere. we need
// special case the source file doesn't actually get used anywhere. we need
// to add an empty file to populate map.sources and map.sourcesContent
if (!parts.length) {
compiled.addSource({
@ -420,7 +420,7 @@ export default class Component {
});
}
const pattern = /\[✂(\d+)-(\d+)$/;
const pattern = /\[(\d+)-(\d+)$/;
parts.forEach((str: string) => {
const chunk = str.replace(pattern, '');
@ -644,7 +644,7 @@ export default class Component {
script.content.body.forEach((node) => {
if (this.hoistable_nodes.has(node) || this.reactive_declaration_nodes.has(node)) {
if (a !== b) result += `[✂${a}-${b}✂]`;
if (a !== b) result += `[${a}-${b}]`;
a = node.end;
}
@ -656,7 +656,7 @@ export default class Component {
b = script.content.end;
while (/\s/.test(this.source[b - 1])) b -= 1;
if (a < b) result += `[✂${a}-${b}✂]`;
if (a < b) result += `[${a}-${b}]`;
return result || null;
}
@ -1107,7 +1107,7 @@ export default class Component {
});
hoistable_nodes.add(node);
this.fully_hoisted.push(`[✂${node.start}-${node.end}✂]`);
this.fully_hoisted.push(`[${node.start}-${node.end}]`);
}
}
@ -1199,7 +1199,7 @@ export default class Component {
remove_indentation(this.code, node);
this.fully_hoisted.push(`[✂${node.start}-${node.end}✂]`);
this.fully_hoisted.push(`[${node.start}-${node.end}]`);
}
}
}

@ -280,7 +280,7 @@ export default class Stylesheet {
const atrule = new Atrule(node);
stack.push(atrule);
// this is an awkward special case — @apply (and
// this is an awkward special case @apply (and
// possibly other future constructs)
if (last && !(last instanceof Atrule)) return;

@ -150,7 +150,7 @@ export default class Element extends Node {
}
if (this.name === 'option') {
// Special case — treat these the same way:
// Special case treat these the same way:
// <option>{foo}</option>
// <option value={foo}>{foo}</option>
const value_attribute = info.attributes.find(attribute => attribute.name === 'value');
@ -547,7 +547,7 @@ export default class Element extends Node {
if (type !== 'checkbox') {
let message = `'${name}' binding can only be used with <input type="checkbox">`;
if (type === 'radio') message += ` — for <input type="radio">, use 'group' binding`;
if (type === 'radio') message += ` for <input type="radio">, use 'group' binding`;
component.error(binding, { code: `invalid-binding`, message });
}
} else if (name === 'group') {

@ -374,7 +374,7 @@ export default class Expression {
throw new Error(`Well that's odd`);
}
// TOOD optimisation — if this is an event handler,
// TOOD optimisation if this is an event handler,
// the return value doesn't matter
}
@ -513,6 +513,6 @@ export default class Expression {
});
}
return this.rendered = `[✂${this.node.start}-${this.node.end}✂]`;
return this.rendered = `[${this.node.start}-${this.node.end}]`;
}
}

@ -369,7 +369,7 @@ export default function dom(
})
.map(n => `$$dirty.${n}`).join(' || ');
let snippet = `[✂${d.node.body.start}-${d.node.end}✂]`;
let snippet = `[${d.node.body.start}-${d.node.end}]`;
if (condition) snippet = `if (${condition}) { ${snippet} }`;
if (condition || uses_props) {

@ -32,7 +32,7 @@ export default class DebugTagWrapper extends Wrapper {
code.overwrite(this.node.start + 1, this.node.start + 7, 'debugger', {
storeName: true
});
const statement = `[✂${this.node.start + 1}-${this.node.start + 7}✂];`;
const statement = `[${this.node.start + 1}-${this.node.start + 7}];`;
block.builders.create.add_line(statement);
block.builders.update.add_line(statement);
@ -41,7 +41,7 @@ export default class DebugTagWrapper extends Wrapper {
code.overwrite(this.node.start + 1, this.node.start + 7, 'log', {
storeName: true
});
const log = `[✂${this.node.start + 1}-${this.node.start + 7}✂]`;
const log = `[${this.node.start + 1}-${this.node.start + 7}]`;
const dependencies = new Set();
this.node.expressions.forEach(expression => {

@ -70,7 +70,7 @@ export default class FragmentWrapper {
throw new Error(`TODO implement ${child.type}`);
}
// special case — this is an easy way to remove whitespace surrounding
// special case this is an easy way to remove whitespace surrounding
// <svelte:window/>. lil hacky but it works
if (child.type === 'Window') {
window_wrapper = new Window(renderer, block, parent, child);

@ -262,7 +262,7 @@ export default class InlineComponentWrapper extends Wrapper {
let object;
if (binding.is_contextual && binding.expression.node.type === 'Identifier') {
// bind:x={y} — we can't just do `y = x`, we need to
// bind:x={y} we can't just do `y = x`, we need to
// to `array[index] = x;
const { name } = binding.expression.node;
const { snippet } = block.bindings.get(name);
@ -316,7 +316,7 @@ export default class InlineComponentWrapper extends Wrapper {
let lhs = component.source.slice(binding.expression.node.start, binding.expression.node.end).trim();
if (binding.is_contextual && binding.expression.node.type === 'Identifier') {
// bind:x={y} — we can't just do `y = x`, we need to
// bind:x={y} we can't just do `y = x`, we need to
// to `array[index] = x;
const { name } = binding.expression.node;
const { object, property, snippet } = block.bindings.get(name);

@ -28,16 +28,16 @@ export default class TitleWrapper extends Wrapper {
const all_dependencies = new Set();
// TODO some of this code is repeated in Tag.ts — would be good to
// TODO some of this code is repeated in Tag.ts would be good to
// DRY it out if that's possible without introducing crazy indirection
if (this.node.children.length === 1) {
// single {tag} — may be a non-string
// single {tag} may be a non-string
// @ts-ignore todo: check this
const { expression } = this.node.children[0];
value = expression.render(block);
add_to_set(all_dependencies, expression.dependencies);
} else {
// '{foo} {bar}' — treat as string concatenation
// '{foo} {bar}' treat as string concatenation
value =
(this.node.children[0].type === 'Text' ? '' : `"" + `) +
this.node.children

@ -43,7 +43,7 @@ export default class Wrapper {
}
get_or_create_anchor(block: Block, parent_node: string, parent_nodes: string) {
// TODO use this in EachBlock and IfBlock — tricky because
// TODO use this in EachBlock and IfBlock tricky because
// children need to be created first
const needs_anchor = this.next ? !this.next.is_dom_node() : !parent_node || !this.parent.is_dom_node();
const anchor = needs_anchor

@ -88,7 +88,7 @@ export default function ssr(
: [];
const reactive_declarations = component.reactive_declarations.map(d => {
let snippet = `[✂${d.node.body.start}-${d.node.end}✂]`;
let snippet = `[${d.node.body.start}-${d.node.end}]`;
if (d.declaration) {
const declared = extract_names(d.declaration);

@ -300,7 +300,7 @@ function read_attribute(parser: Parser, unique_names: Set<string>) {
if (type === 'Ref') {
parser.error({
code: `invalid-ref-directive`,
message: `The ref directive is no longer supported — use \`bind:this={${directive_name}}\` instead`
message: `The ref directive is no longer supported use \`bind:this={${directive_name}}\` instead`
}, start);
}
@ -485,7 +485,7 @@ export default function tag(parser: Parser) {
element.expression = definition.value[0].expression;
}
// special cases – top-level <script> and <style>
// special cases - top-level <script> and <style>
if (specials.has(name) && parser.stack.length === 1) {
const special = specials.get(name);

@ -58,7 +58,7 @@ function validate_code(code: number) {
}
// code points 128-159 are dealt with leniently by browsers, but they're incorrect. We need
// to correct the mistake or we'll end up with missing € signs and so on
// to correct the mistake or we'll end up with missing signs and so on
if (code <= 159) {
return windows_1252[code - 128];
}

Loading…
Cancel
Save