Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite to use Web IDL, and generally modernize #1035

Merged
merged 30 commits into from
Jun 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
ca89482
Rewrite to use Web IDL, and generally modernize
domenic Apr 9, 2020
ae7ce51
Callback context does matter, actually
domenic Apr 14, 2020
e44ec8e
Align with spec-factory
domenic Apr 14, 2020
dbf913f
Make first arguments optional again
domenic Apr 14, 2020
2304a01
Start of ref impl updates
domenic Apr 14, 2020
504f25d
Writable stream updates
domenic Apr 15, 2020
d916d28
Converted readable streams
domenic Apr 16, 2020
8453d74
IDL and promise fixes
domenic Apr 17, 2020
0758900
Transform streams and more
domenic Apr 17, 2020
533f58c
Uniformly check for zero-length buffers
domenic Apr 21, 2020
616254d
Make byobRequest null instead of undefined for no-request
domenic Apr 21, 2020
c04fd91
Fix issues noted by ricea so far
domenic Apr 21, 2020
85de416
Fix typo
domenic Apr 21, 2020
10a22ab
Ref impl fixes
domenic Apr 22, 2020
6cf5303
Make view nullable, not undefined-able
domenic Apr 22, 2020
b7ab6be
Add async iterableness to spec
domenic Apr 22, 2020
4ff1dc1
Fix example indentation
domenic Apr 22, 2020
28ff9ed
Tweak domintro
domenic Apr 22, 2020
1b7085b
Add back missing space
domenic Apr 22, 2020
4748ef0
Upgrade webidl2js
domenic Apr 29, 2020
82fac0e
Change domintro format for getReader() too
domenic Apr 29, 2020
9216e46
More WPT updates
domenic Apr 29, 2020
f7e3704
Remove highWaterMark setter
domenic May 5, 2020
0116889
Use webidl2js v16.1.0
domenic May 5, 2020
1b34185
Use webidl2js branch which supports async iterators
domenic May 18, 2020
3a0dc28
Tweak conventions section
domenic May 18, 2020
d80964e
More conventions section tweaks
domenic May 19, 2020
eadc755
Use new Web IDL "end of iteration" for async iterator
domenic May 26, 2020
bb3766f
More async iterator updates
domenic Jun 5, 2020
1da8031
Sync webidl2js and WPT!
domenic Jun 11, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@ charset = utf-8
indent_size = 2
indent_style = space
trim_trailing_whitespace = true
max_line_length = 100

[*.{js,bs}]
[Makefile]
indent_style = tab

[*.bs]
indent_size = 1

[*.py]
indent_size = 4

[*.js]
max_line_length = 120

[.gitmodules]
indent_style = tab

[Makefile]
indent_style = tab

[.travis.yml]
indent_size = 2
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@
/deploy_key.pub
/index.html
/review.sh
/index.html.*
/node_modules/
/npm-debug.log
20 changes: 7 additions & 13 deletions .pr-preview.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
{
"src_file": "index.bs",
"type": "bikeshed",
"params": {
"force": 1,
"md-status": "LS-PR",
"md-Text-Macro": "PR-NUMBER {{ pull_request.number }}"
},
"post_processing": {
"name": "emu-algify",
"options": {
"throwingIndicators": true
}
}
"src_file": "index.bs",
"type": "bikeshed",
"params": {
"force": 1,
"md-status": "LS-PR",
"md-Text-Macro": "PR-NUMBER {{ pull_request.number }}"
}
}
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: node_js
node_js: stable
sudo: false

env:
global:
Expand All @@ -12,7 +11,6 @@ before_install:
script:
- npm test
- cd ..
- npm install
- make deploy

branches:
Expand Down
18 changes: 13 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,25 @@ SHELL=/bin/bash -o pipefail
.PHONY: local remote deploy review

remote: index.bs
curl https://api.csswg.org/bikeshed/ -f -F [email protected] > index.html.postbs -F md-Text-Macro="SNAPSHOT-LINK LOCAL COPY"
node_modules/.bin/emu-algify --throwing-indicators < index.html.postbs > index.html
@ (HTTP_STATUS=$$(curl https://api.csswg.org/bikeshed/ \
--output index.html \
--write-out "%{http_code}" \
--header "Accept: text/plain, text/html" \
-F die-on=warning \
-F md-Text-Macro="COMMIT-SHA LOCAL COPY" \
-F [email protected]) && \
[[ "$$HTTP_STATUS" -eq "200" ]]) || ( \
echo ""; cat index.html; echo ""; \
rm -f index.html; \
exit 22 \
);

local: index.bs
bikeshed spec index.bs index.html.postbs --md-Text-Macro="SNAPSHOT-LINK LOCAL COPY"
node_modules/.bin/emu-algify --throwing-indicators < index.html.postbs > index.html
bikeshed spec index.bs index.html --md-Text-Macro="COMMIT-SHA LOCAL COPY"

deploy: index.bs
curl --remote-name --fail https://resources.whatwg.org/build/deploy.sh
EXTRA_FILES="demos/* demos/**/*" \
POST_BUILD_STEP='node_modules/.bin/emu-algify --throwing-indicators < "$$DIR/index.html" > "$$DIR/index.html.tmp"; mv "$$DIR/index.html.tmp" "$$DIR/index.html"' \
bash ./deploy.sh

review: index.bs
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ implementation in order to pass those tests.

## Building "locally"

This standard requires a recent version of [Node.js](https://nodejs.org/en/) to be installed as a
prerequisite. Once that's done, you'll need to do a one-time run of `npm install` to set up our
tooling.

For quick local iteration, run `make`. To verify your changes locally, run `make deploy`. See more
in the
[WHATWG Contributor Guidelines](https://github.com/whatwg/meta/blob/master/CONTRIBUTING.md#building).
Expand Down
10,870 changes: 5,541 additions & 5,329 deletions index.bs

Large diffs are not rendered by default.

83 changes: 0 additions & 83 deletions local-watch.js

This file was deleted.

11 changes: 0 additions & 11 deletions package.json

This file was deleted.

1 change: 1 addition & 0 deletions reference-implementation/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
web-platform-tests/
coverage/
generated/
12 changes: 4 additions & 8 deletions reference-implementation/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,15 @@
"env": {
"node": true,
"browser": true,
"es6": true
"es2020": true
},
"parserOptions": {
"ecmaVersion": 2018
"ecmaVersion": 2020
},
"globals": {
"ReadableStream": false,
"WritableStream": false,
"TransformStream": false,
"ByteLengthQueuingStrategy": false,
"CountQueuingStrategy": false,
"GCController": false,
"gc": false
"gc": false,
"globalThis": false
},
"rules": {
// Possible errors
Expand Down
1 change: 1 addition & 0 deletions reference-implementation/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ package-lock.json

.nyc_output/
coverage/
generated/
22 changes: 22 additions & 0 deletions reference-implementation/compile-idl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';
/* eslint-disable no-console, no-process-exit */
const { mkdirSync } = require('fs');
const path = require('path');
const Transformer = require('webidl2js');

const input = path.resolve(__dirname, './lib');
const output = path.resolve(__dirname, './generated');

mkdirSync(output, { recursive: true });

const transformer = new Transformer({
implSuffix: '-impl',
suppressErrors: true // until https://github.com/jsdom/webidl2js/pull/123 lands
});

transformer.addSource(input, input);
transformer.generate(output)
.catch(err => {
console.error(err.stack);
process.exit(1);
});
26 changes: 26 additions & 0 deletions reference-implementation/lib/ByteLengthQueuingStrategy-impl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';

exports.implementation = class ByteLengthQueuingStrategyImpl {
constructor(globalObject, [{ highWaterMark }]) {
this._globalObject = globalObject;
this.highWaterMark = highWaterMark;
}

get size() {
initializeSizeFunction(this._globalObject);
return sizeFunctionWeakMap.get(this._globalObject);
}
};

const sizeFunctionWeakMap = new WeakMap();
function initializeSizeFunction(globalObject) {
if (sizeFunctionWeakMap.has(globalObject)) {
return;
}

// We need to set the 'name' property:
// eslint-disable-next-line prefer-arrow-callback
sizeFunctionWeakMap.set(globalObject, function size(chunk) {
return chunk.byteLength;
});
}
7 changes: 7 additions & 0 deletions reference-implementation/lib/ByteLengthQueuingStrategy.webidl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Exposed=(Window,Worker,Worklet)]
interface ByteLengthQueuingStrategy {
constructor(QueuingStrategyInit init);

readonly attribute unrestricted double highWaterMark;
readonly attribute Function size;
};
26 changes: 26 additions & 0 deletions reference-implementation/lib/CountQueuingStrategy-impl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';

exports.implementation = class CountQueuingStrategyImpl {
constructor(globalObject, [{ highWaterMark }]) {
this._globalObject = globalObject;
this.highWaterMark = highWaterMark;
}

get size() {
initializeSizeFunction(this._globalObject);
return sizeFunctionWeakMap.get(this._globalObject);
}
};

const sizeFunctionWeakMap = new WeakMap();
function initializeSizeFunction(globalObject) {
if (sizeFunctionWeakMap.has(globalObject)) {
return;
}

// We need to set the 'name' property:
// eslint-disable-next-line prefer-arrow-callback
sizeFunctionWeakMap.set(globalObject, function size() {
return 1;
});
}
7 changes: 7 additions & 0 deletions reference-implementation/lib/CountQueuingStrategy.webidl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Exposed=(Window,Worker,Worklet)]
interface CountQueuingStrategy {
constructor(QueuingStrategyInit init);

readonly attribute unrestricted double highWaterMark;
readonly attribute Function size;
};
6 changes: 6 additions & 0 deletions reference-implementation/lib/QueuingStrategy.webidl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dictionary QueuingStrategy {
unrestricted double highWaterMark;
QueuingStrategySize size;
};

callback QueuingStrategySize = unrestricted double (optional any chunk);
3 changes: 3 additions & 0 deletions reference-implementation/lib/QueuingStrategyInit.webidl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dictionary QueuingStrategyInit {
required unrestricted double highWaterMark;
};
Loading