Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

webidl2

Package Overview
Dependencies
Maintainers
4
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webidl2 - npm Package Compare versions

Comparing version 17.0.0 to 17.0.1

77

CHANGELOG.md
# Change Log
## [v17.0.1](https://github.com/w3c/webidl2.js/tree/v17.0.1) (2018-12-11)
[Full Changelog](https://github.com/w3c/webidl2.js/compare/v17.0.0...v17.0.1)
**Closed issues:**
- idlTypes should unescape type name [\#252](https://github.com/w3c/webidl2.js/issues/252)
- Union type must not allow `any` type [\#250](https://github.com/w3c/webidl2.js/issues/250)
- Include statements do not unescape type names [\#249](https://github.com/w3c/webidl2.js/issues/249)
**Merged pull requests:**
- fix\(lib/webidl2\): prevent any in a union type [\#254](https://github.com/w3c/webidl2.js/pull/254) ([saschanaz](https://github.com/saschanaz))
- fix: unescape includes/idlTypes/inheritances [\#253](https://github.com/w3c/webidl2.js/pull/253) ([saschanaz](https://github.com/saschanaz))
- feat\(lib/webidl\): subclass standard error [\#247](https://github.com/w3c/webidl2.js/pull/247) ([saschanaz](https://github.com/saschanaz))
## [v17.0.0](https://github.com/w3c/webidl2.js/tree/v17.0.0) (2018-12-08)
[Full Changelog](https://github.com/w3c/webidl2.js/compare/v16.1.0...v17.0.0)
**Closed issues:**
- Arguments shouldn't get its own extended attributes [\#246](https://github.com/w3c/webidl2.js/issues/246)
- Modify writer to be ReSpec compatible [\#210](https://github.com/w3c/webidl2.js/issues/210)
**Merged pull requests:**
- BREAKING CHANGE: remove .extAttrs from arguments [\#248](https://github.com/w3c/webidl2.js/pull/248) ([saschanaz](https://github.com/saschanaz))
## [v16.1.0](https://github.com/w3c/webidl2.js/tree/v16.1.0) (2018-12-02)
[Full Changelog](https://github.com/w3c/webidl2.js/compare/v16.0.0...v16.1.0)
**Closed issues:**
- Emit preceding tokens for error messages [\#180](https://github.com/w3c/webidl2.js/issues/180)
**Merged pull requests:**
- Add unit tests for writer template functions [\#245](https://github.com/w3c/webidl2.js/pull/245) ([saschanaz](https://github.com/saschanaz))
- feat\(lib/webidl2\): better error messages [\#244](https://github.com/w3c/webidl2.js/pull/244) ([saschanaz](https://github.com/saschanaz))
- Add docs for template feature [\#243](https://github.com/w3c/webidl2.js/pull/243) ([saschanaz](https://github.com/saschanaz))
- \[WIP\] write\(\) with optional templates [\#241](https://github.com/w3c/webidl2.js/pull/241) ([saschanaz](https://github.com/saschanaz))
## [v16.0.0](https://github.com/w3c/webidl2.js/tree/v16.0.0) (2018-11-24)
[Full Changelog](https://github.com/w3c/webidl2.js/compare/v15.0.0...v16.0.0)
**Implemented enhancements:**
- eslint: prevent eval\(\) [\#234](https://github.com/w3c/webidl2.js/pull/234) ([tripu](https://github.com/tripu))
**Closed issues:**
- Revise README document about testing [\#164](https://github.com/w3c/webidl2.js/issues/164)
- document white space [\#97](https://github.com/w3c/webidl2.js/issues/97)
- types of types [\#93](https://github.com/w3c/webidl2.js/issues/93)
**Merged pull requests:**
- BREAKING CHANGE: merge modifier fields [\#240](https://github.com/w3c/webidl2.js/pull/240) ([saschanaz](https://github.com/saschanaz))
- refactor\(lib/writer\): use interface\_like\(\) [\#239](https://github.com/w3c/webidl2.js/pull/239) ([saschanaz](https://github.com/saschanaz))
- refactor\(lib/writer\): use token\(\) [\#238](https://github.com/w3c/webidl2.js/pull/238) ([saschanaz](https://github.com/saschanaz))
- refactor\(lib/writer\): reduce conditional constructs [\#237](https://github.com/w3c/webidl2.js/pull/237) ([saschanaz](https://github.com/saschanaz))
- Remove jscoverage file and guide [\#236](https://github.com/w3c/webidl2.js/pull/236) ([saschanaz](https://github.com/saschanaz))
- chore\(package\): update eslint [\#235](https://github.com/w3c/webidl2.js/pull/235) ([saschanaz](https://github.com/saschanaz))
## [v15.0.0](https://github.com/w3c/webidl2.js/tree/v15.0.0) (2018-10-11)

@@ -202,3 +265,3 @@ [Full Changelog](https://github.com/w3c/webidl2.js/compare/v14.0.1...v15.0.0)

## [v10.3.2](https://github.com/w3c/webidl2.js/tree/v10.3.2) (2018-04-16)
[Full Changelog](https://github.com/w3c/webidl2.js/compare/v10.2.1...v10.3.2)
[Full Changelog](https://github.com/w3c/webidl2.js/compare/v10.3.1...v10.3.2)

@@ -210,3 +273,15 @@ **Merged pull requests:**

- refactor: one-to-one match for token matcher [\#143](https://github.com/w3c/webidl2.js/pull/143) ([saschanaz](https://github.com/saschanaz))
## [v10.3.1](https://github.com/w3c/webidl2.js/tree/v10.3.1) (2018-03-17)
[Full Changelog](https://github.com/w3c/webidl2.js/compare/v10.3.0...v10.3.1)
**Merged pull requests:**
- const-type as full IDL Type [\#142](https://github.com/w3c/webidl2.js/pull/142) ([saschanaz](https://github.com/saschanaz))
## [v10.3.0](https://github.com/w3c/webidl2.js/tree/v10.3.0) (2018-03-17)
[Full Changelog](https://github.com/w3c/webidl2.js/compare/v10.2.1...v10.3.0)
**Merged pull requests:**
- Always add extAttrs for .idlType [\#141](https://github.com/w3c/webidl2.js/pull/141) ([saschanaz](https://github.com/saschanaz))

@@ -213,0 +288,0 @@ - docs\(README\): add types of types \[ci skip\] [\#140](https://github.com/w3c/webidl2.js/pull/140) ([saschanaz](https://github.com/saschanaz))

40

lib/webidl2.js

@@ -168,5 +168,6 @@ "use strict";

class WebIDLParseError {
class WebIDLParseError extends Error {
constructor(str, line, input, tokens) {
this.message = str;
super(str);
this.name = this.constructor.name;
this.line = line;

@@ -178,5 +179,4 @@ this.input = input;

toString() {
const escapedInput = JSON.stringify(this.input);
const tokens = JSON.stringify(this.tokens, null, 4);
return `${this.message}, line ${this.line} (tokens: ${escapedInput})\n${tokens}`;
return `${this.message}\n${tokens}`;
}

@@ -208,2 +208,3 @@ }

baseName: null,
escapedBaseName: null,
prefix: null,

@@ -327,2 +328,3 @@ postfix: null,

baseName: base.value,
escapedBaseName: base.value,
trivia: { base: base.trivia }

@@ -342,2 +344,3 @@ };

baseName: base.value,
escapedBaseName: base.value,
trivia: { base: base.trivia }

@@ -357,2 +360,3 @@ };

baseName: base.value,
escapedBaseName: base.value,
trivia: { base: base.trivia }

@@ -404,2 +408,3 @@ };

baseName: name.value,
escapedBaseName: name.value,
generic: { value: name.value, trivia: {} },

@@ -427,2 +432,3 @@ trivia: { base: name.trivia }

baseName: keyType.value,
escapedBaseName: keyType.value,
idlType: keyType.value,

@@ -455,3 +461,4 @@ separator,

}
ret.baseName = ret.idlType = name.value;
ret.baseName = ret.idlType = unescape(name.value);
ret.escapedBaseName = name.value;
ret.trivia.base = name.trivia;

@@ -464,3 +471,3 @@ if (probe("<")) error(`Unsupported generic type ${name.value}`);

type_suffix(ret);
if (ret.nullable && ret.idlType === "any") error("Type any cannot be made nullable");
if (ret.nullable && ret.idlType === "any") error("Type `any` cannot be made nullable");
return ret;

@@ -476,2 +483,3 @@ }

const typ = type_with_extended_attributes() || error("No type after open parenthesis or 'or' in union type");
if (typ.idlType === "any") error("Type `any` cannot be included in a union type");
ret.idlType.push(typ);

@@ -660,3 +668,8 @@ const or = untyped_consume("or");

typ = consume(ID) || error("No type for const");
typ = { idlType: typ.value, baseName: typ.value, trivia: { base: typ.trivia } };
typ = {
idlType: typ.value,
baseName: typ.value,
escapedBaseName: typ.value,
trivia: { base: typ.trivia }
};
}

@@ -683,3 +696,7 @@ ret.idlType = Object.assign({ type: "const-type" }, EMPTY_IDLTYPE, typ);

const inh = consume(ID) || error("No type in inheritance");
return { name: inh.value, trivia: { colon: colon.trivia, name: inh.trivia } };
return {
name: unescape(inh.value),
escapedName: inh.value,
trivia: { colon: colon.trivia, name: inh.trivia }
};
}

@@ -790,2 +807,3 @@ }

baseName: "void",
escapedBaseName: "void",
trivia: { base: voidToken.trivia }

@@ -1148,7 +1166,9 @@ });

type: "includes",
target: target.value
target: unescape(target.value),
escapedTarget: target.value
};
const imp = consume(ID) || error("Incomplete includes statement");
trivia.mixin = imp.trivia;
ret.includes = imp.value;
ret.includes = unescape(imp.value);
ret.escapedIncludes = imp.value;
ret.trivia = trivia;

@@ -1155,0 +1175,0 @@ const termination = consume(";") || error("No terminating ; for includes statement");

@@ -32,4 +32,4 @@ "use strict";

function reference(wrapped, normalized) {
return ts.reference(wrapped, normalized || wrapped);
function reference(raw, unescaped) {
return ts.reference(raw, unescaped || raw);
}

@@ -61,3 +61,3 @@

if (!it.prefix && !it.postfix) {
return wrap`${trivia.base}${reference(it.baseName)}`;
return wrap`${trivia.base}${reference(it.escapedBaseName, it.baseName)}`;
}

@@ -171,3 +171,3 @@ const precedingTrivia = it.prefix ? ts.trivia(it.prefix.trivia) : trivia.base;

const trivia = extract_trivia(inh);
return wrap`${trivia.colon}:${trivia.name}${ts.inheritance(reference(inh.name))}`;
return wrap`${trivia.colon}:${trivia.name}${ts.inheritance(reference(inh.escapedName, inh.name))}`;
}

@@ -242,4 +242,4 @@

const ret = extended_attributes(it.extAttrs);
const target = reference(it.target);
const mixin = reference(it.includes);
const target = reference(it.escapedTarget, it.target);
const mixin = reference(it.escapedIncludes, it.includes);
return ts.definition(

@@ -246,0 +246,0 @@ wrap`${ret}${trivia.target}${target}${trivia.includes}includes${trivia.mixin}${mixin}${trivia.termination};`,

{
"name": "webidl2",
"description": "A WebIDL Parser",
"version": "17.0.0",
"version": "17.0.1",
"contributors": [

@@ -6,0 +6,0 @@ "Robin Berjon <robin@berjon.com> (https://berjon.com)",

@@ -82,6 +82,7 @@

* Called for each type referece, e.g. `Window`, `Promise`, or `unsigned long`.
* @param ref The referenced name. Typically string, but may also be the return
* @param escaped The referenced name. Typically string, but may also be the return
* value of `wrap()` if the name contains whitespace.
* @param unescaped Unescaped reference.
*/
reference: ref => ref,
reference: (escaped, unescaped) => escaped,
/**

@@ -88,0 +89,0 @@ * Called only once for each types, e.g. `Document`, `Promise<DOMString>`, or `sequence<long>`.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc