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

Remove all "import type" after discovery of a TS bug #1073

Merged
merged 2 commits into from
Jul 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 3 additions & 4 deletions src/main-thread/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
* limitations under the License.
*/

import type { MessageFromWorker, MessageToWorker } from '../transfer/Messages';
import type { Phase } from '../transfer/Phase';
import type { HydrateableNode } from '../transfer/TransferrableNodes';

import { MessageFromWorker, MessageToWorker } from '../transfer/Messages';
import { Phase } from '../transfer/Phase';
import { HydrateableNode } from '../transfer/TransferrableNodes';
import { DefaultAllowedMutations } from '../transfer/TransferrableMutation';

/**
Expand Down
22 changes: 13 additions & 9 deletions src/main-thread/debugging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,22 @@
* @see https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#9.4
*/

import type { EventToWorker, MessageToWorker, ValueSyncToWorker, BoundingClientRectToWorker, StorageValueToWorker } from '../transfer/Messages';
import type { HydrateableNode, TransferredNode } from '../transfer/TransferrableNodes';
import type { NodeContext } from './nodes';
import type { TransferrableEvent } from '../transfer/TransferrableEvent';
import type { TransferrableSyncValue } from '../transfer/TransferrableSyncValue';
import type { WorkerContext } from './worker';

import { MessageType } from '../transfer/Messages';
import { TransferrableNodeIndex } from '../transfer/TransferrableNodes';
import {
EventToWorker,
MessageType,
MessageToWorker,
ValueSyncToWorker,
BoundingClientRectToWorker,
StorageValueToWorker,
} from '../transfer/Messages';
import { HydrateableNode, TransferredNode, TransferrableNodeIndex } from '../transfer/TransferrableNodes';
import { NodeContext } from './nodes';
import { TransferrableEvent } from '../transfer/TransferrableEvent';
import { TransferrableKeys } from '../transfer/TransferrableKeys';
import { TransferrableSyncValue } from '../transfer/TransferrableSyncValue';
import { createReadableHydrateableRootNode } from './serialize';
import { WorkerDOMConfiguration } from './configuration';
import { WorkerContext } from './worker';

/**
* @param element
Expand Down
7 changes: 3 additions & 4 deletions src/main-thread/deserializeTransferrableObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
* limitations under the License.
*/

import type { StringContext } from './strings';
import type { NodeContext } from './nodes';
import type { ObjectContext } from './object-context';

import { StringContext } from './strings';
import { TransferrableObjectType } from '../transfer/TransferrableMutation';
import { NodeContext } from './nodes';
import { ObjectContext } from './object-context';

interface DeserializedArgs {
args: unknown[];
Expand Down
8 changes: 3 additions & 5 deletions src/main-thread/exported-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@
* limitations under the License.
*/

import type { WorkerContext } from './worker';
import type { WorkerDOMConfiguration } from './configuration';
import type { FunctionCallToWorker } from '../transfer/Messages';

import { WorkerContext } from './worker';
import { WorkerDOMConfiguration } from './configuration';
import { registerPromise } from './commands/function';
import { MessageType } from '../transfer/Messages';
import { FunctionCallToWorker, MessageType } from '../transfer/Messages';
import { TransferrableKeys } from '../transfer/TransferrableKeys';
import { TransferrableMutationType } from '../transfer/TransferrableMutation';

Expand Down
5 changes: 2 additions & 3 deletions src/main-thread/index.amp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
* @fileoverview This entry point API in active development and unstable.
*/

import type { ExportedWorker } from './exported-worker';
import type { WorkerDOMConfiguration, LongTaskFunction } from './configuration';

import { fetchAndInstall, install } from './install';
import { WorkerDOMConfiguration, LongTaskFunction } from './configuration';
import { toLower } from '../utils';
import { ExportedWorker } from './exported-worker';

/**
* AMP Element Children need to be filtered from Hydration, to avoid Author Code from manipulating it.
Expand Down
2 changes: 1 addition & 1 deletion src/main-thread/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import type { ExportedWorker } from './exported-worker';
import { fetchAndInstall } from './install';
import { ExportedWorker } from './exported-worker';

export function upgradeElement(baseElement: Element, domURL: string): Promise<ExportedWorker | null> {
const authorURL = baseElement.getAttribute('src');
Expand Down
7 changes: 2 additions & 5 deletions src/main-thread/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@
* limitations under the License.
*/

import type { MutationFromWorker, MessageFromWorker } from '../transfer/Messages';
import type { InboundWorkerDOMConfiguration } from './configuration';

import { MessageType } from '../transfer/Messages';
import { MutationFromWorker, MessageType, MessageFromWorker } from '../transfer/Messages';
import { MutatorProcessor } from './mutator';
import { NodeContext } from './nodes';
import { StringContext } from './strings';
import { TransferrableKeys } from '../transfer/TransferrableKeys';
import { normalizeConfiguration } from './configuration';
import { InboundWorkerDOMConfiguration, normalizeConfiguration } from './configuration';
import { WorkerContext } from './worker';
import { ObjectContext } from './object-context';
import { ExportedWorker } from './exported-worker';
Expand Down
15 changes: 7 additions & 8 deletions src/main-thread/mutator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,9 @@
* limitations under the License.
*/

import type { NodeContext } from './nodes';
import type { StringContext } from './strings';
import type { WorkerContext } from './worker';
import type { WorkerDOMConfiguration, MutationPumpFunction } from './configuration';
import type { CommandExecutor } from './commands/interface';
import type { Phase } from '../transfer/Phase';
import type { ObjectContext } from './object-context';

import { NodeContext } from './nodes';
import { StringContext } from './strings';
import { WorkerContext } from './worker';
import { OffscreenCanvasProcessor } from './commands/offscreen-canvas';
import { TransferrableMutationType, ReadableMutationType, isUserVisibleMutation } from '../transfer/TransferrableMutation';
import { EventSubscriptionProcessor } from './commands/event-subscription';
Expand All @@ -31,8 +26,12 @@ import { AttributeProcessor } from './commands/attribute';
import { CharacterDataProcessor } from './commands/character-data';
import { PropertyProcessor } from './commands/property';
import { LongTaskExecutor } from './commands/long-task';
import { CommandExecutor } from './commands/interface';
import { WorkerDOMConfiguration, MutationPumpFunction } from './configuration';
import { Phase } from '../transfer/Phase';
import { ObjectMutationProcessor } from './commands/object-mutation';
import { ObjectCreationProcessor } from './commands/object-creation';
import { ObjectContext } from './object-context';
import { ImageBitmapProcessor } from './commands/image-bitmap';
import { StorageProcessor } from './commands/storage';
import { FunctionProcessor } from './commands/function';
Expand Down
2 changes: 1 addition & 1 deletion src/main-thread/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import type { StringContext } from './strings';
import { NodeType, TransferrableNodeIndex } from '../transfer/TransferrableNodes';
import { StringContext } from './strings';

/**
* IE11 doesn't support NodeList.prototype.forEach
Expand Down
8 changes: 3 additions & 5 deletions src/main-thread/serialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@
* limitations under the License.
*/

import type { HydrateableNode } from '../transfer/TransferrableNodes';
import type { WorkerDOMConfiguration, HydrationFilterPredicate } from './configuration';
import type { WorkerContext } from './worker';

import { NodeType } from '../transfer/TransferrableNodes';
import { HydrateableNode, NodeType } from '../transfer/TransferrableNodes';
import { TransferrableKeys } from '../transfer/TransferrableKeys';
import { NumericBoolean } from '../utils';
import { WorkerDOMConfiguration, HydrationFilterPredicate } from './configuration';
import { applyDefaultInputListener, sendValueChangeOnAttributeMutation } from './commands/event-subscription';
import { WorkerContext } from './worker';

const NODES_ALLOWED_TO_TRANSMIT_TEXT_CONTENT = [NodeType.COMMENT_NODE, NodeType.TEXT_NODE];

Expand Down
7 changes: 3 additions & 4 deletions src/main-thread/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
* limitations under the License.
*/

import type { MessageToWorker } from '../transfer/Messages';
import type { WorkerDOMConfiguration } from './configuration';
import type { NodeContext } from './nodes';

import { MessageToWorker } from '../transfer/Messages';
import { WorkerDOMConfiguration } from './configuration';
import { createHydrateableRootNode } from './serialize';
import { readableHydrateableRootNode, readableMessageToWorker } from './debugging';
import { NodeContext } from './nodes';
import { TransferrableKeys } from '../transfer/TransferrableKeys';
import { StorageLocation } from '../transfer/TransferrableStorage';
import { IframeWorker } from './iframe-worker';
Expand Down
4 changes: 2 additions & 2 deletions src/third_party/html-parser/html-parser.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Element } from '../../worker-thread/dom/Element';
import type { Node } from '../../worker-thread/dom/Node';
import { Element } from '../../worker-thread/dom/Element';
import { Node } from '../../worker-thread/dom/Node';
import { SVG_NAMESPACE, HTML_NAMESPACE } from '../../transfer/TransferrableNodes';
import { toLower, toUpper } from '../../utils';

Expand Down
14 changes: 7 additions & 7 deletions src/transfer/Messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* limitations under the License.
*/

import type { TransferrableEvent } from './TransferrableEvent';
import type { TransferrableSyncValue } from './TransferrableSyncValue';
import type { TransferrableKeys } from './TransferrableKeys';
import type { HydrateableNode, TransferredNode } from './TransferrableNodes';
import type { TransferrableBoundingClientRect } from './TransferrableBoundClientRect';
import type { Phase } from './Phase';
import type { StorageLocation } from './TransferrableStorage';
import { TransferrableEvent } from './TransferrableEvent';
import { TransferrableSyncValue } from './TransferrableSyncValue';
import { TransferrableKeys } from './TransferrableKeys';
import { HydrateableNode, TransferredNode } from './TransferrableNodes';
import { TransferrableBoundingClientRect } from './TransferrableBoundClientRect';
import { Phase } from './Phase';
import { StorageLocation } from './TransferrableStorage';

export const enum MessageType {
// INIT = 0,
Expand Down
4 changes: 2 additions & 2 deletions src/transfer/TransferrableEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import type { TransferredNode } from './TransferrableNodes';
import type { TransferrableKeys } from './TransferrableKeys';
import { TransferredNode } from './TransferrableNodes';
import { TransferrableKeys } from './TransferrableKeys';

interface TransferrableTouch {
[key: number]: number;
Expand Down
4 changes: 2 additions & 2 deletions src/transfer/TransferrableNodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import type { NumericBoolean } from '../utils';
import type { TransferrableKeys } from './TransferrableKeys';
import { NumericBoolean } from '../utils';
import { TransferrableKeys } from './TransferrableKeys';

export const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
export const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
Expand Down
2 changes: 1 addition & 1 deletion src/transfer/TransferrableSyncValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import type { TransferrableKeys } from './TransferrableKeys';
import { TransferrableKeys } from './TransferrableKeys';

export interface TransferrableSyncValue {
readonly [TransferrableKeys.index]: number;
Expand Down
14 changes: 6 additions & 8 deletions src/worker-thread/Event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@
* WorkerDOM's `Event` class. `CustomEvent` is available natively in web worker.
*/

import type { Node } from './dom/Node';
import type { EventToWorker } from '../transfer/Messages';
import type { TransferrableEvent, TransferrableTouchList } from '../transfer/TransferrableEvent';
import type { Document } from './dom/Document';
import type { TransferredNode } from '../transfer/TransferrableNodes';
import type { WorkerDOMGlobalScope } from './WorkerDOMGlobalScope';

import { Node } from './dom/Node';
import { TransferrableKeys } from '../transfer/TransferrableKeys';
import { MessageType } from '../transfer/Messages';
import { EventToWorker, MessageType } from '../transfer/Messages';
import { TransferrableEvent, TransferrableTouchList } from '../transfer/TransferrableEvent';
import { get } from './nodes';
import { Document } from './dom/Document';
import { TransferredNode } from '../transfer/TransferrableNodes';
import { WorkerDOMGlobalScope } from './WorkerDOMGlobalScope';

interface EventOptions {
bubbles?: boolean;
Expand Down
7 changes: 3 additions & 4 deletions src/worker-thread/MutationObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
* limitations under the License.
*/

import type { Document } from './dom/Document';
import type { Node } from './dom/Node';
import type { MutationRecord } from './MutationRecord';

import { Node } from './dom/Node';
import { MutationRecord } from './MutationRecord';
import { TransferrableKeys } from '../transfer/TransferrableKeys';
import { Document } from './dom/Document';
import { transfer } from './MutationTransfer';

const observers: MutationObserver[] = [];
Expand Down
2 changes: 1 addition & 1 deletion src/worker-thread/MutationRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import type { Node } from './dom/Node';
import { Node } from './dom/Node';

// MutationRecord interface is modification and extension of the spec version.
// It supports capturing property changes.
Expand Down
10 changes: 4 additions & 6 deletions src/worker-thread/MutationTransfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,15 @@
* limitations under the License.
*/

import type { MutationFromWorker } from '../transfer/Messages';
import type { Node } from './dom/Node';
import type { Document } from './dom/Document';
import type { DocumentStub } from './dom/DocumentLite';

import { consume as consumeNodes } from './nodes';
import { consume as consumeStrings } from './strings';
import { MessageType } from '../transfer/Messages';
import { MessageType, MutationFromWorker } from '../transfer/Messages';
import { TransferrableKeys } from '../transfer/TransferrableKeys';
import { Node } from './dom/Node';
import { Phase } from '../transfer/Phase';
import { phase, set as setPhase } from './phase';
import { Document } from './dom/Document';
import { DocumentStub } from './dom/DocumentLite';

let pending = false;
let pendingMutations: Array<number> = [];
Expand Down
6 changes: 2 additions & 4 deletions src/worker-thread/ResizePropagation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@
* limitations under the License.
*/

import type { MessageToWorker, ResizeSyncToWorker } from '../transfer/Messages';
import type { WorkerDOMGlobalScope } from './WorkerDOMGlobalScope';

import { MessageType } from '../transfer/Messages';
import { MessageToWorker, MessageType, ResizeSyncToWorker } from '../transfer/Messages';
import { TransferrableKeys } from '../transfer/TransferrableKeys';
import { WorkerDOMGlobalScope } from './WorkerDOMGlobalScope';

export function propagate(global: WorkerDOMGlobalScope): void {
const document = global.document;
Expand Down
5 changes: 2 additions & 3 deletions src/worker-thread/Storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
* limitations under the License.
*/

import type { Document } from './dom/Document';
import type { DocumentStub } from './dom/DocumentLite';

import { Document } from './dom/Document';
import { GetOrSet } from '../transfer/Messages';
import { StorageLocation } from '../transfer/TransferrableStorage';
import { TransferrableMutationType } from '../transfer/TransferrableMutation';
import { store } from './strings';
import { transfer } from './MutationTransfer';
import { DocumentStub } from './dom/DocumentLite';

/**
* @see https://developer.mozilla.org/en-US/docs/Web/API/Storage
Expand Down
8 changes: 3 additions & 5 deletions src/worker-thread/SyncValuePropagation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@
* limitations under the License.
*/

import type { MessageToWorker, ValueSyncToWorker } from '../transfer/Messages';
import type { Document } from './dom/Document';
import type { WorkerDOMGlobalScope } from './WorkerDOMGlobalScope';

import { MessageType } from '../transfer/Messages';
import { MessageToWorker, MessageType, ValueSyncToWorker } from '../transfer/Messages';
import { TransferrableKeys } from '../transfer/TransferrableKeys';
import { get } from './nodes';
import { Document } from './dom/Document';
import { WorkerDOMGlobalScope } from './WorkerDOMGlobalScope';

/**
* When an event is dispatched from the main thread, it needs to be propagated in the worker thread.
Expand Down
Loading