Skip to content

Commit 183f4e7

Browse files
committed
fix: copy source files from fix/node24 for correct import type keywords
Node 24 native TS requires explicit `import type` for type-only imports. Copy all source .ts files from fix/node24 which have the correct type keywords. Restore parse5 v6 types for files with DefaultTreeAdapterTypes. Fix package subpath imports (.ts -> .js for @web/* package imports). Fix extractModulesAndAssets type mismatch. Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c1e189b commit 183f4e7

58 files changed

Lines changed: 329 additions & 2771 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/dev-server-core/src/dom5/iteration.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
* http://polymer.github.io/PATENTS.txt
1313
*/
1414

15-
import { isElement, Predicate, predicates as p } from './predicates.ts';
16-
import { defaultChildNodes, GetChildNodes } from './util.ts';
15+
import { isElement, predicates as p } from './predicates.ts';
16+
import type { Predicate } from './predicates.ts';
17+
import { defaultChildNodes } from './util.ts';
18+
import type { GetChildNodes } from './util.ts';
1719

1820
/**
1921
* Applies `mapfn` to `node` and the tree below `node`, yielding a flattened

packages/dev-server-core/src/dom5/modification.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function newTextNode(value: string): any {
2222
value: value,
2323
parentNode: undefined,
2424
attrs: [],
25-
__location: <any>undefined,
25+
__location: undefined as any,
2626
};
2727
}
2828

@@ -32,7 +32,7 @@ function newCommentNode(comment: string): any {
3232
data: comment,
3333
parentNode: undefined,
3434
attrs: [],
35-
__location: <any>undefined,
35+
__location: undefined as any,
3636
};
3737
}
3838

@@ -44,7 +44,7 @@ function newElement(tagName: string, namespace?: string): any {
4444
namespaceURI: namespace || 'http://www.w3.org/1999/xhtml',
4545
attrs: [],
4646
parentNode: undefined,
47-
__location: <any>undefined,
47+
__location: undefined as any,
4848
};
4949
}
5050

@@ -99,7 +99,7 @@ function insertNode(parent: any, index: number, newNode: any, replace?: boolean)
9999
removedNode = parent.childNodes[index];
100100
}
101101

102-
Array.prototype.splice.apply(parent.childNodes, (<any>[index, replace ? 1 : 0]).concat(newNodes));
102+
Array.prototype.splice.apply(parent.childNodes, ([index, replace ? 1 : 0] as any).concat(newNodes));
103103

104104
newNodes.forEach(function (n) {
105105
n.parentNode = parent;

packages/dev-server-core/src/dom5/walking.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
*/
1414

1515
import * as iteration from './iteration.ts';
16-
import { isElement, Predicate, predicates as p } from './predicates.ts';
17-
import { defaultChildNodes, GetChildNodes } from './util.ts';
16+
import { isElement, predicates as p } from './predicates.ts';
17+
import type { Predicate } from './predicates.ts';
18+
import { defaultChildNodes } from './util.ts';
19+
import type { GetChildNodes } from './util.ts';
1820

1921
/**
2022
* Applies `mapfn` to `node` and the tree below `node`, returning a flattened

packages/dev-server-core/src/plugins/transformModuleImportsPlugin.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
/* eslint-disable @typescript-eslint/ban-ts-comment */
22
import path from 'path';
3-
import { Context } from 'koa';
3+
import type { Context } from 'koa';
44
// @ts-ignore
5-
import { parse, ParsedImport } from 'es-module-lexer';
5+
import { parse } from 'es-module-lexer';
66

77
import { queryAll, predicates, getTextContent, setTextContent } from '../dom5/index.ts';
88
import { parse as parseHtml, serialize as serializeHtml } from 'parse5';
9-
import { Plugin } from './Plugin.ts';
9+
import type { Plugin } from './Plugin.ts';
1010
import { PluginSyntaxError } from '../logger/PluginSyntaxError.ts';
1111
import { toFilePath } from '../utils.ts';
12-
import { Logger } from '../logger/Logger.ts';
12+
import type { Logger } from '../logger/Logger.ts';
1313
import { parseDynamicImport } from './parseDynamicImport.ts';
1414

1515
export type ResolveImport = (

packages/dev-server-core/src/server/createServer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export function createServer(
6868

6969
let server: Server;
7070
if (cfg.http2) {
71-
const dir = path.join(__dirname, '..');
71+
const dir = path.join(import.meta.dirname, '..');
7272
const options = {
7373
key: fs.readFileSync(
7474
cfg.sslKey

packages/dev-server-core/src/web-sockets/webSocketsPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Plugin } from '../plugins/Plugin.ts';
1+
import type { Plugin } from '../plugins/Plugin.ts';
22
import { NAME_WEB_SOCKET_IMPORT, NAME_WEB_SOCKET_API } from './WebSocketsManager.ts';
33
import { appendToDocument, isHtmlFragment } from '@web/parse5-utils';
44

packages/dev-server-esbuild/test/banner-footer.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import assert from 'node:assert/strict';
22
import { describe, it } from 'node:test';
33
import path from 'path';
4-
import { createTestServer } from '@web/dev-server-core/test-helpers.ts';
5-
import { expectIncludes } from '@web/dev-server-core/test-helpers.ts';
4+
import { createTestServer } from '@web/dev-server-core/test-helpers.js';
5+
import { expectIncludes } from '@web/dev-server-core/test-helpers.js';
66

77
import { esbuildPlugin } from '../src/index.js';
88

packages/dev-server-esbuild/test/json.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import assert from 'node:assert/strict';
22
import { describe, it } from 'node:test';
33
import path from 'path';
4-
import { expectIncludes, createTestServer } from '@web/dev-server-core/test-helpers.ts';
4+
import { expectIncludes, createTestServer } from '@web/dev-server-core/test-helpers.js';
55

66
import { esbuildPlugin } from '../src/index.js';
77

packages/dev-server-esbuild/test/jsx.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import assert from 'node:assert/strict';
22
import { describe, it } from 'node:test';
33
import path from 'path';
4-
import { expectIncludes, createTestServer } from '@web/dev-server-core/test-helpers.ts';
4+
import { expectIncludes, createTestServer } from '@web/dev-server-core/test-helpers.js';
55

66
import { esbuildPlugin } from '../src/index.js';
77

packages/dev-server-esbuild/test/target.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import assert from 'node:assert/strict';
22
import { describe, it } from 'node:test';
33
import path from 'path';
4-
import { createTestServer, expectIncludes } from '@web/dev-server-core/test-helpers.ts';
4+
import { createTestServer, expectIncludes } from '@web/dev-server-core/test-helpers.js';
55

66
import { esbuildPlugin } from '../src/index.js';
77

0 commit comments

Comments
 (0)