Skip to content

Commit

Permalink
Updates to recent dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
kristoferbaxter committed Apr 13, 2020
1 parent 7a7f7b1 commit 8e205ba
Show file tree
Hide file tree
Showing 29 changed files with 88 additions and 91 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: yarn install
- run: yarn size
- run: yarn filesize
3 changes: 2 additions & 1 deletion config/rollup.plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ export function babelPlugin({ transpileToES5, allowConsole = false, allowPostMes
'@babel/env',
{
targets,
loose: transpileToES5 ? false : true,
loose: true,
modules: false,
bugfixes: true,
},
],
],
Expand Down
5 changes: 0 additions & 5 deletions config/tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
"variable-name": [
true,
"ban-keywords",
"check-format",
"allow-trailing-underscore",
"allow-leading-underscore"
],
"triple-equals": [true, "allow-null-check"],
"prefer-const": true,
"use-isnan": true,
"radix": true,
"only-arrow-functions": [true, "allow-declarations", "allow-named-functions"],
"object-literal-shorthand": true,
"no-debugger": true,
"no-duplicate-variable": true,
Expand All @@ -22,8 +19,6 @@
"ban": [
true,
"alert",
{"name": "parseInt", "message": "tsstyle#type-coercion"},
{"name": "parseFloat", "message": "tsstyle#type-coercion"},
{"name": "Array", "message": "tsstyle#array-constructor"}
],
"ban-types": [true,
Expand Down
14 changes: 7 additions & 7 deletions demo/preact-dbmon/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@
<title>DBMON</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="dbmon.css" rel="stylesheet" type="text/css">
<script src="/dist/main.mjs" type="module"></script>
<script src="/dist/main.js" nomodule defer></script>
<!-- <script src="/dist/main.mjs" type="module"></script>
<script src="/dist/main.js" nomodule defer></script> -->
<!-- This comment block is intended to make it easier to test both the script module and nomodule path -->
<!-- Comment either block to enable module/nomodule or disable it. -->
<!-- <script src="./dist/main.js" defer></script> -->
<script src="/dist/main.js" defer></script>
</head>
<body>
<div src="dbmon.js" id="upgrade-me"></div>
<script type="module">
<!-- <script type="module">
import {upgradeElement} from '/dist/main.mjs';
upgradeElement(document.getElementById('upgrade-me'), '/dist/worker/worker.mjs');
</script>
<script nomodule async=false defer>
document.addEventListener('DOMContentLoaded', function() {
MainThread.upgradeElement(document.getElementById('upgrade-me'), '/dist/worker/worker.js');
}, false);
</script>
</script> -->
<!-- This comment block is intended to make it easier to test both the script module and nomodule path -->
<!-- Comment either block to enable module/nomodule or disable it. -->
<!-- <script async=false defer>
<script async=false defer>
document.addEventListener('DOMContentLoaded', function() {
MainThread.upgradeElement(document.getElementById('upgrade-me'), '/dist/worker/worker.js');
}, false);
</script> -->
</script>
<script src="monitor.js"></script>
</body>
</html>
34 changes: 16 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,46 +35,44 @@
"demo": "node -r esm demo/server.js",
"build": "cross-env MINIFY_BUNDLE=true npm-run-all ~rollup",
"presize": "npm-run-all build",
"size": "filesize",
"release": "np",
"release": "np --no-2fa",
"prepublishOnly": "npm-run-all clean build"
},
"devDependencies": {
"@ampproject/filesize": "3.0.2",
"@ampproject/rollup-plugin-closure-compiler": "0.22.2",
"@ampproject/filesize": "3.2.1",
"@ampproject/rollup-plugin-closure-compiler": "0.25.2",
"@babel/cli": "7.8.4",
"@babel/core": "7.8.4",
"@babel/core": "7.9.0",
"@babel/plugin-proposal-class-properties": "7.8.3",
"@babel/plugin-proposal-object-rest-spread": "7.8.3",
"@babel/preset-env": "7.8.4",
"@babel/plugin-proposal-object-rest-spread": "7.9.5",
"@babel/preset-env": "7.9.5",
"@rollup/plugin-replace": "2.3.1",
"@types/node": "13.7.4",
"@types/sinon": "7.5.1",
"acorn": "7.1.0",
"acorn": "7.1.1",
"acorn-walk": "7.1.1",
"ava": "3.3.0",
"babel-plugin-minify-replace": "0.5.0",
"babel-plugin-transform-remove-console": "6.9.4",
"cross-env": "7.0.0",
"cross-var": "1.1.0",
"esm": "3.2.25",
"husky": "4.2.3",
"jsdom": "16.2.0",
"lint-staged": "10.0.7",
"magic-string": "0.25.6",
"np": "6.1.0",
"lint-staged": "10.1.3",
"magic-string": "0.25.7",
"np": "https://github.com/pixelastic/np/tarball/c3ab2e3b053c7da0ce40a572ca1616273ac080f8",
"npm-run-all": "4.1.5",
"polka": "0.5.2",
"prettier": "1.19.1",
"prettier": "2.0.4",
"rimraf": "3.0.2",
"rollup": "1.31.1",
"rollup-plugin-babel": "4.3.3",
"rollup": "2.6.1",
"rollup-plugin-babel": "4.4.0",
"rollup-plugin-copy": "3.3.0",
"rollup-plugin-terser": "5.2.0",
"rollup-plugin-terser": "5.3.0",
"sinon": "9.0.0",
"sirv": "0.4.2",
"tslint": "5.20.1",
"typescript": "3.7.5"
"tslint": "6.1.1",
"typescript": "3.8.3"
},
"lint-staged": {
"*.{js,ts}": [
Expand Down
2 changes: 1 addition & 1 deletion src/main-thread/commands/attribute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const AttributeProcessor: CommandExecutorInterface = (strings, nodes, wor
}
return startPosition + AttributeMutationIndex.End;
},
print(mutations: Uint16Array, startPosition: number): Object {
print(mutations: Uint16Array, startPosition: number): {} {
const targetIndex = mutations[startPosition + AttributeMutationIndex.Target];
const target = nodes.getNode(targetIndex);
const attributeName = strings.get(mutations[startPosition + AttributeMutationIndex.Name]);
Expand Down
2 changes: 1 addition & 1 deletion src/main-thread/commands/bounding-client-rect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const BoundingClientRectProcessor: CommandExecutorInterface = (strings, n

return startPosition + BoundClientRectMutationIndex.End;
},
print(mutations: Uint16Array, startPosition: number): Object {
print(mutations: Uint16Array, startPosition: number): {} {
const targetIndex = mutations[startPosition + BoundClientRectMutationIndex.Target];
const target = nodes.getNode(targetIndex);
return {
Expand Down
2 changes: 1 addition & 1 deletion src/main-thread/commands/character-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const CharacterDataProcessor: CommandExecutorInterface = (strings, nodes,
}
return startPosition + CharacterDataMutationIndex.End;
},
print(mutations: Uint16Array, startPosition: number): Object {
print(mutations: Uint16Array, startPosition: number): {} {
const targetIndex = mutations[startPosition + CharacterDataMutationIndex.Target];
const target = nodes.getNode(targetIndex);
return {
Expand Down
2 changes: 1 addition & 1 deletion src/main-thread/commands/child-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const ChildListProcessor: CommandExecutorInterface = (strings, { getNode
}
return startPosition + ChildListMutationIndex.End + appendNodeCount + removeNodeCount;
},
print(mutations: Uint16Array, startPosition: number): Object {
print(mutations: Uint16Array, startPosition: number): {} {
const targetIndex = mutations[startPosition + ChildListMutationIndex.Target];
const target = getNode(targetIndex);
const appendNodeCount = mutations[startPosition + ChildListMutationIndex.AppendedNodeCount];
Expand Down
12 changes: 6 additions & 6 deletions src/main-thread/commands/event-subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ const shouldTrackChanges = (node: HTMLElement): boolean => node && 'value' in no
* @param node node to listen to value changes on.
*/
export const applyDefaultInputListener = (workerContext: WorkerContext, node: RenderableElement): void => {
shouldTrackChanges(node as HTMLElement) && node.oninput === null && (node.oninput = () => fireValueChange(workerContext, node));
if (shouldTrackChanges(node as HTMLElement) && node.oninput === null) {
node.oninput = () => fireValueChange(workerContext, node);
}
};

/**
Expand Down Expand Up @@ -234,7 +236,7 @@ export const EventSubscriptionProcessor: CommandExecutorInterface = (strings, no

return endPosition;
},
print(mutations: Uint16Array, startPosition: number): Object {
print(mutations: Uint16Array, startPosition: number): {} {
const addEventListenerCount = mutations[startPosition + EventSubscriptionMutationIndex.AddEventListenerCount];
const removeEventListenerCount = mutations[startPosition + EventSubscriptionMutationIndex.RemoveEventListenerCount];
const addEventListenersPosition =
Expand All @@ -244,12 +246,10 @@ export const EventSubscriptionProcessor: CommandExecutorInterface = (strings, no
EventSubscriptionMutationIndex.Events +
addEventListenerCount * ADD_EVENT_SUBSCRIPTION_LENGTH +
removeEventListenerCount * REMOVE_EVENT_SUBSCRIPTION_LENGTH;

const targetIndex = mutations[startPosition + EventSubscriptionMutationIndex.Target];
const target = nodeContext.getNode(targetIndex);

let removedEventListeners: Array<{ type: string; index: number }> = [];
let addedEventListeners: Array<{ type: string; index: number }> = [];
const removedEventListeners: Array<{ type: string; index: number }> = [];
const addedEventListeners: Array<{ type: string; index: number }> = [];

let iterator = startPosition + EventSubscriptionMutationIndex.Events;
while (iterator < endPosition) {
Expand Down
2 changes: 1 addition & 1 deletion src/main-thread/commands/image-bitmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const ImageBitmapProcessor: CommandExecutorInterface = (strings, nodeCont

return startPosition + ImageBitmapMutationIndex.End;
},
print(mutations: Uint16Array, startPosition: number): Object {
print(mutations: Uint16Array, startPosition: number): {} {
const targetIndex = mutations[startPosition + ImageBitmapMutationIndex.Target];
const target = nodeContext.getNode(targetIndex);
return {
Expand Down
2 changes: 1 addition & 1 deletion src/main-thread/commands/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface CommandExecutor {
*/
execute(mutations: Uint16Array, startPosition: number, allow: boolean): number;

print(mutations: Uint16Array, startPosition: number): Object;
print(mutations: Uint16Array, startPosition: number): {};
}

export interface CommandExecutorInterface {
Expand Down
2 changes: 1 addition & 1 deletion src/main-thread/commands/long-task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const LongTaskExecutor: LongTaskCommandExecutorInterface = (
}
return startPosition + LongTaskMutationIndex.End;
},
print(mutations: Uint16Array, startPosition: number): Object {
print(mutations: Uint16Array, startPosition: number): {} {
return {
type: ReadableMutationType[mutations[startPosition]],
allowedExecution,
Expand Down
2 changes: 1 addition & 1 deletion src/main-thread/commands/object-creation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const ObjectCreationProcessor: CommandExecutorInterface = (strings, nodeC

return argsOffset;
},
print(mutations: Uint16Array, startPosition: number): Object {
print(mutations: Uint16Array, startPosition: number): {} {
const functionName = strings.get(mutations[startPosition + ObjectCreationIndex.FunctionName]);
const objectId = mutations[startPosition + ObjectCreationIndex.ObjectId];
const argCount = mutations[startPosition + ObjectCreationIndex.ArgumentCount];
Expand Down
4 changes: 2 additions & 2 deletions src/main-thread/commands/object-mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const ObjectMutationProcessor: CommandExecutorInterface = (strings, nodeC

return argsOffset;
},
print(mutations: Uint16Array, startPosition: number): Object {
print(mutations: Uint16Array, startPosition: number): {} {
const functionName = strings.get(mutations[startPosition + ObjectMutationIndex.FunctionName]);
const { args: deserializedTarget } = deserializeTransferrableObject(
mutations,
Expand All @@ -71,7 +71,7 @@ export const ObjectMutationProcessor: CommandExecutorInterface = (strings, nodeC
};
};

function isSetter(object: Object, name: string): boolean {
function isSetter(object: {}, name: string): boolean {
if (!object) {
throw new Error(`Property ${name} does not exist on ${object}.`);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main-thread/commands/offscreen-canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const OffscreenCanvasProcessor: CommandExecutorInterface = (strings, node

return startPosition + OffscreenCanvasMutationIndex.End;
},
print(mutations: Uint16Array, startPosition: number, target?: RenderableElement | null): Object {
print(mutations: Uint16Array, startPosition: number, target?: RenderableElement | null): {} {
return {
type: 'OFFSCREEN_CANVAS_INSTANCE',
target,
Expand Down
2 changes: 1 addition & 1 deletion src/main-thread/commands/property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const PropertyProcessor: CommandExecutorInterface = (strings, nodeContext

return startPosition + PropertyMutationIndex.End;
},
print(mutations: Uint16Array, startPosition: number): Object {
print(mutations: Uint16Array, startPosition: number): {} {
const targetIndex = mutations[startPosition + PropertyMutationIndex.Target];
const target = nodeContext.getNode(targetIndex);
const name = strings.get(mutations[startPosition + PropertyMutationIndex.Name]);
Expand Down
2 changes: 1 addition & 1 deletion src/main-thread/commands/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const StorageProcessor: CommandExecutorInterface = (strings, nodeContext,

return startPosition + StorageMutationIndex.End;
},
print(mutations: Uint16Array, startPosition: number): Object {
print(mutations: Uint16Array, startPosition: number): {} {
const operation = mutations[startPosition + StorageMutationIndex.Operation];
const location = mutations[startPosition + StorageMutationIndex.Location];
const keyIndex = mutations[startPosition + StorageMutationIndex.Key];
Expand Down
14 changes: 7 additions & 7 deletions src/main-thread/debugging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ import { WorkerContext } from './worker';
/**
* @param element
*/
export const readableHydrateableRootNode = (element: RenderableElement, config: WorkerDOMConfiguration, workerContext: WorkerContext): Object =>
export const readableHydrateableRootNode = (element: RenderableElement, config: WorkerDOMConfiguration, workerContext: WorkerContext): {} =>
readableHydrateableNode(createReadableHydrateableRootNode(element, config, workerContext));
/**
* @param nodeContext {NodeContext}
* @param node {TransferredNode}
*/
export const readableTransferredNode = (nodeContext: NodeContext, node: TransferredNode): Object | number | null =>
export const readableTransferredNode = (nodeContext: NodeContext, node: TransferredNode): {} | number | null =>
(node != null && nodeContext.getNode(node[TransferrableNodeIndex.Index])) || node;

/**
* @param node
*/
function readableHydrateableNode(node: HydrateableNode): Object {
function readableHydrateableNode(node: HydrateableNode): {} {
const out: any = {
nodeType: node[TransferrableKeys.nodeType],
name: node[TransferrableKeys.localOrNodeName],
Expand Down Expand Up @@ -83,8 +83,8 @@ const isBoundingClientRect = (message: MessageToWorker): message is BoundingClie
* @param nodeContext {NodeContext}
* @param event {TransferrableEvent}
*/
function readableTransferrableEvent(nodeContext: NodeContext, event: TransferrableEvent): Object {
const value = (item?: null | number | boolean | TransferredNode): number | boolean | Object | null => {
function readableTransferrableEvent(nodeContext: NodeContext, event: TransferrableEvent): {} {
const value = (item?: null | number | boolean | TransferredNode): number | boolean | {} | null => {
if (typeof item === 'number' || typeof item === 'boolean') {
return item !== undefined ? item : null;
}
Expand All @@ -111,7 +111,7 @@ function readableTransferrableEvent(nodeContext: NodeContext, event: Transferrab
* @param nodeContext {NodeContext}
* @param value {TransferrableSyncValue}
*/
function readableTransferrableSyncValue(nodeContext: NodeContext, value: TransferrableSyncValue): Object {
function readableTransferrableSyncValue(nodeContext: NodeContext, value: TransferrableSyncValue): {} {
const index = value[TransferrableKeys.index];
return {
target: nodeContext.getNode(index) || index,
Expand All @@ -122,7 +122,7 @@ function readableTransferrableSyncValue(nodeContext: NodeContext, value: Transfe
/**
* @param message
*/
export function readableMessageToWorker(nodeContext: NodeContext, message: MessageToWorker): Object {
export function readableMessageToWorker(nodeContext: NodeContext, message: MessageToWorker): {} {
if (isEvent(message)) {
const event = message[TransferrableKeys.event];
return {
Expand Down
2 changes: 1 addition & 1 deletion src/main-thread/mutator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ export class MutatorProcessor {
}
const disallowedMutations: TransferrableMutationType[] = [];
this.mutationQueue.forEach(mutationArray => {
const length: number = mutationArray.length;
let operationStart: number = 0;
let length: number = mutationArray.length;

while (operationStart < length) {
// TransferrableMutationType is always at position 0.
Expand Down
2 changes: 1 addition & 1 deletion src/third_party/html-parser/html-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export function parse(data: string, rootElement: Element) {

while ((match = kMarkupPattern.exec(data))) {
const commentContents = match[1]; // <!--contents-->
let beginningSlash = match[2]; // ... </ ...
const beginningSlash = match[2]; // ... </ ...
const tagName = match[3];
const matchAttributes = match[4];
const endSlash = match[5]; // ... /> ...
Expand Down
4 changes: 2 additions & 2 deletions src/transfer/Messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ export interface BoundingClientRectToWorker {
export interface OffscreenCanvasToWorker {
[TransferrableKeys.type]: MessageType.OFFSCREEN_CANVAS_INSTANCE;
[TransferrableKeys.target]: TransferredNode;
[TransferrableKeys.data]: Object; // This will be an OffscreenCanvas
[TransferrableKeys.data]: {}; // This will be an OffscreenCanvas
}
export interface ImageBitmapToWorker {
[TransferrableKeys.type]: MessageType.IMAGE_BITMAP_INSTANCE;
[TransferrableKeys.callIndex]: number; // number that indicates the number of the image bitmap call
[TransferrableKeys.data]: Object; // This will be an ImageBitmap object
[TransferrableKeys.data]: {}; // This will be an ImageBitmap object
}
export interface ResizeSyncToWorker {
[TransferrableKeys.type]: MessageType.RESIZE;
Expand Down
Loading

0 comments on commit 8e205ba

Please sign in to comment.