Skip to content

Commit

Permalink
refactor: drop the xmlchars module
Browse files Browse the repository at this point in the history
BREAKING CHANGE: the xmlchars module, which had been deprecated, is now gone.
  • Loading branch information
lddubeau committed Jun 23, 2019
1 parent a55561d commit b9f8285
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 342 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ work well for people who cared about code optimization. Importing `xmlchars`
meant importing *all* of the library and because of the way the code was
generated there was no way to shake the resulting code tree.

Since version 1.3.0, importing `xmlchars` is deprecated. Instead, you should
directly load the file from `xmlchars/lib` that you care about. Even without
tree shaking being used, this results in a smaller footprint.

Different modules cover different standards. At the time this documentation was
last updated, we had:

Expand Down
192 changes: 0 additions & 192 deletions src/xmlchars.ts

This file was deleted.

146 changes: 0 additions & 146 deletions test/xmlchars.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import { expect } from "chai";
import * as xml_1_0_ed4 from "../src/xml/1.0/ed4";
import * as xml_1_0_ed5 from "../src/xml/1.0/ed5";
import { XML_1_0, XMLNS_1_0 } from "../src/xmlchars";
import * as xmlns_1_0_ed3 from "../src/xmlns/1.0/ed3";

interface Fixture {
Expand Down Expand Up @@ -175,151 +174,6 @@ function makeCodePointTestTests(codePointTest: (c: number) => boolean,
}
}

describe("XML_1_0", () => {
describe("ED5", () => {
// tslint:disable-next-line:mocha-no-side-effect-code
const cases: Record<keyof typeof XML_1_0.ED5.regexes, Case> = {
CHAR: {
matching: [x, poo, colon, space, tab, newline, cr, ideographic,
combining, digit, extender],
},
S: {
matching: [space, tab, newline, cr],
},
NAME_START_CHAR: {
matching: [x, ideographic, poo, colon],
},
NAME_CHAR: {
matching: [x, ideographic, poo, colon, combining, extender, digit],
},
NAME: {
matching: [x, abc, ideographic, colon, nameWithColon, poo],
},
NMTOKEN: {
matching: [x, abc, ideographic, colon, nameWithColon, leadingDot,
leadingDash, leadingDigit, combining, extender, digit, poo],
},
};
describe(".regexes", () => {
// tslint:disable-next-line:mocha-no-side-effect-code
for (const name of (Object.keys(cases) as (keyof typeof cases)[])) {
describe(name, () => {
// tslint:disable-next-line:mocha-no-side-effect-code
makeTests(XML_1_0.ED5.regexes[name], cases[name]);
});
}
});

describe(".isChar", () => {
// tslint:disable-next-line:mocha-no-side-effect-code
makeCodePointTestTests(XML_1_0.ED5.isChar, cases.CHAR);
});

describe(".isS", () => {
// tslint:disable-next-line:mocha-no-side-effect-code
makeCodePointTestTests(XML_1_0.ED5.isS, cases.S);
});

describe(".isNameStartChar", () => {
// tslint:disable-next-line:mocha-no-side-effect-code
makeCodePointTestTests(XML_1_0.ED5.isNameStartChar,
cases.NAME_START_CHAR);
});

describe(".isNameChar", () => {
// tslint:disable-next-line:mocha-no-side-effect-code
makeCodePointTestTests(XML_1_0.ED5.isNameChar, cases.NAME_CHAR);
});
});

describe("ED4.regexes", () => {
// tslint:disable-next-line:mocha-no-side-effect-code
const cases: Record<keyof typeof XML_1_0.ED4.regexes, Case> = {
CHAR: {
matching: [x, poo, colon, space, tab, newline, cr, ideographic,
combining, digit, extender],
},
S: {
matching: [space, tab, newline, cr],
},
BASE_CHAR: {
matching: [x],
},
IDEOGRAPHIC: {
matching: [ideographic],
},
COMBINING_CHAR: {
matching: [combining],
},
DIGIT: {
matching: [digit],
},
EXTENDER: {
matching: [extender],
},
LETTER: {
matching: [x, ideographic],
},
NAME_CHAR: {
matching: [x, ideographic, colon, digit, extender, combining],
},
NAME: {
matching: [x, abc, ideographic, colon, nameWithColon],
},
NMTOKEN: {
matching: [x, abc, ideographic, colon, nameWithColon, leadingDot,
leadingDash, leadingDigit, combining, extender, digit],
},
};

// tslint:disable-next-line:mocha-no-side-effect-code
for (const name of (Object.keys(cases) as (keyof typeof cases)[])) {
describe(name, () => {
// tslint:disable-next-line:mocha-no-side-effect-code
makeTests(XML_1_0.ED4.regexes[name], cases[name]);
});
}
});
});

describe("XML_NS_1_0", () => {
describe("ED3", () => {
// tslint:disable-next-line:mocha-no-side-effect-code
const cases: Record<keyof typeof XMLNS_1_0.ED3.regexes, Case> = {
NC_NAME_START_CHAR: {
matching: [x, ideographic, poo],
},
NC_NAME_CHAR: {
matching: [x, ideographic, poo, combining, extender, digit],
},
NC_NAME: {
matching: [x, abc, ideographic, poo],
},
};

describe(".regexes", () => {
// tslint:disable-next-line:mocha-no-side-effect-code
for (const name of (Object.keys(cases) as (keyof typeof cases)[])) {
describe(name, () => {
// tslint:disable-next-line:mocha-no-side-effect-code
makeTests(XMLNS_1_0.ED3.regexes[name], cases[name]);
});
}
});

describe(".isNCNameStartChar", () => {
// tslint:disable-next-line:mocha-no-side-effect-code
makeCodePointTestTests(XMLNS_1_0.ED3.isNCNameStartChar,
cases.NC_NAME_START_CHAR);
});

describe(".isNCNameChar", () => {
// tslint:disable-next-line:mocha-no-side-effect-code
makeCodePointTestTests(XMLNS_1_0.ED3.isNCNameChar, cases.NC_NAME_CHAR);
});
});
});

type FilterPropertyName<T, P> =
{ [K in keyof T]: T[K] extends P ? K : never }[keyof T];

Expand Down

0 comments on commit b9f8285

Please sign in to comment.