diff --git a/common/BUILD.bazel b/common/BUILD.bazel index 4305e378..0c07f237 100644 --- a/common/BUILD.bazel +++ b/common/BUILD.bazel @@ -6,14 +6,14 @@ load(":paths_test.bzl", "paths_test_suite") ts_project( name = "binary", - srcs = ["binary.ts"], + srcs = ["binary.mts"], visibility = ["//visibility:public"], deps = ["//:node_modules/@types/node"], ) ts_project( name = "binary_test_lib", - srcs = ["binary_test.ts"], + srcs = ["binary_test.mts"], testonly = True, deps = [ ":binary", @@ -28,13 +28,13 @@ jasmine_node_test( ts_project( name = "collections", - srcs = ["collections.ts"], + srcs = ["collections.mts"], visibility = ["//visibility:public"], ) ts_project( name = "collections_test_lib", - srcs = ["collections_test.ts"], + srcs = ["collections_test.mts"], testonly = True, deps = [ ":collections", @@ -49,13 +49,13 @@ jasmine_node_test( ts_project( name = "formatters", - srcs = ["formatters.ts"], + srcs = ["formatters.mts"], visibility = ["//visibility:public"], ) ts_project( name = "formatters_test_lib", - srcs = ["formatters_test.ts"], + srcs = ["formatters_test.mts"], testonly = True, deps = [ ":formatters", @@ -70,14 +70,14 @@ jasmine_node_test( ts_project( name = "file_system", - srcs = ["file_system.ts"], + srcs = ["file_system.mts"], visibility = ["//visibility:public"], deps = ["//:node_modules/@types/node"], ) ts_project( name = "file_system_fake", - srcs = ["file_system_fake.ts"], + srcs = ["file_system_fake.mts"], visibility = ["//visibility:public"], testonly = True, deps = [ @@ -88,14 +88,14 @@ ts_project( ts_project( name = "http", - srcs = ["http.ts"], + srcs = ["http.mts"], visibility = ["//visibility:public"], deps = ["//:node_modules/@types/node"], ) ts_project( name = "http_test_lib", - srcs = ["http_test.ts"], + srcs = ["http_test.mts"], testonly = True, deps = [ ":http", @@ -139,7 +139,7 @@ paths_test_suite(name = "paths_test") ts_project( name = "prerender_annotation_walker", - srcs = ["prerender_annotation_walker.ts"], + srcs = ["prerender_annotation_walker.mts"], visibility = ["//visibility:public"], deps = [ "//common/models:prerender_annotation", @@ -149,7 +149,7 @@ ts_project( ts_project( name = "prerender_annotation_walker_test_lib", - srcs = ["prerender_annotation_walker_test.ts"], + srcs = ["prerender_annotation_walker_test.mts"], testonly = True, data = ["//:node_modules/node-html-parser"], deps = [ @@ -167,13 +167,13 @@ jasmine_node_test( ts_project( name = "probably", - srcs = ["probably.ts"], + srcs = ["probably.mts"], visibility = ["//visibility:public"], ) ts_project( name = "probably_test_lib", - srcs = ["probably_test.ts"], + srcs = ["probably_test.mts"], testonly = True, deps = [ ":probably", diff --git a/common/binary.ts b/common/binary.mts similarity index 100% rename from common/binary.ts rename to common/binary.mts diff --git a/common/binary_test.ts b/common/binary_test.mts similarity index 97% rename from common/binary_test.ts rename to common/binary_test.mts index 9fb68633..c882254b 100644 --- a/common/binary_test.ts +++ b/common/binary_test.mts @@ -1,4 +1,4 @@ -import { main as mainReal } from './binary'; +import { main as mainReal } from './binary.mjs'; // Wrap `main`'s type to return its `Promise` to easily `await` it. function main(...args: Parameters): Promise { diff --git a/common/collections.ts b/common/collections.mts similarity index 100% rename from common/collections.ts rename to common/collections.mts diff --git a/common/collections_test.ts b/common/collections_test.mts similarity index 95% rename from common/collections_test.ts rename to common/collections_test.mts index ce28c35b..5b70a388 100644 --- a/common/collections_test.ts +++ b/common/collections_test.mts @@ -1,4 +1,4 @@ -import { unique } from './collections'; +import { unique } from './collections.mjs'; describe('collections', () => { describe('unique()', () => { diff --git a/common/file_system.ts b/common/file_system.mts similarity index 100% rename from common/file_system.ts rename to common/file_system.mts diff --git a/common/file_system_fake.ts b/common/file_system_fake.mts similarity index 97% rename from common/file_system_fake.ts rename to common/file_system_fake.mts index c6684d47..9f9848f1 100644 --- a/common/file_system_fake.ts +++ b/common/file_system_fake.mts @@ -1,5 +1,5 @@ import * as path from 'path'; -import { FileSystem } from './file_system'; +import { FileSystem } from './file_system.mjs'; /** * A fake implementation of the `FileSystem` interface which stores everything diff --git a/common/formatters.ts b/common/formatters.mts similarity index 100% rename from common/formatters.ts rename to common/formatters.mts diff --git a/common/formatters_test.ts b/common/formatters_test.mts similarity index 95% rename from common/formatters_test.ts rename to common/formatters_test.mts index 47f2f40c..14d3c74c 100644 --- a/common/formatters_test.ts +++ b/common/formatters_test.mts @@ -1,4 +1,4 @@ -import { mdSpacing } from './formatters'; +import { mdSpacing } from './formatters.mjs'; describe('formatters', () => { describe('spaceMarkdown()', () => { diff --git a/common/http.ts b/common/http.mts similarity index 100% rename from common/http.ts rename to common/http.mts diff --git a/common/http_test.ts b/common/http_test.mts similarity index 98% rename from common/http_test.ts rename to common/http_test.mts index 61a0b54a..d96c45b6 100644 --- a/common/http_test.ts +++ b/common/http_test.mts @@ -1,6 +1,6 @@ import nodeHttp from 'http'; import { URL } from 'url'; -import * as http from './http'; +import * as http from './http.mjs'; describe('http', () => { describe('get', () => { diff --git a/common/models/BUILD.bazel b/common/models/BUILD.bazel index ddca76a4..9f9588d7 100644 --- a/common/models/BUILD.bazel +++ b/common/models/BUILD.bazel @@ -3,13 +3,13 @@ load("//tools/typescript:defs.bzl", "ts_project") ts_project( name = "prerender_annotation", - srcs = ["prerender_annotation.ts"], + srcs = ["prerender_annotation.mts"], visibility = ["//visibility:public"], ) ts_project( name = "prerender_annotation_test_lib", - srcs = ["prerender_annotation_test.ts"], + srcs = ["prerender_annotation_test.mts"], testonly = True, deps = [ ":prerender_annotation", @@ -24,7 +24,7 @@ jasmine_node_test( ts_project( name = "prerender_annotation_mock", - srcs = ["prerender_annotation_mock.ts"], + srcs = ["prerender_annotation_mock.mts"], testonly = True, visibility = ["//visibility:public"], deps = [":prerender_annotation"], @@ -32,13 +32,13 @@ ts_project( ts_project( name = "prerender_metadata", - srcs = ["prerender_metadata.ts"], + srcs = ["prerender_metadata.mts"], visibility = ["//visibility:public"], ) ts_project( name = "prerender_metadata_test_lib", - srcs = ["prerender_metadata_test.ts"], + srcs = ["prerender_metadata_test.mts"], testonly = True, deps = [ ":prerender_metadata", @@ -53,7 +53,7 @@ jasmine_node_test( ts_project( name = "prerender_metadata_mock", - srcs = ["prerender_metadata_mock.ts"], + srcs = ["prerender_metadata_mock.mts"], testonly = True, visibility = ["//visibility:public"], deps = [":prerender_metadata"], @@ -61,14 +61,14 @@ ts_project( ts_project( name = "prerender_resource", - srcs = ["prerender_resource.ts"], + srcs = ["prerender_resource.mts"], visibility = ["//visibility:public"], deps = [":url_path"], ) ts_project( name = "prerender_resource_test_lib", - srcs = ["prerender_resource_test.ts"], + srcs = ["prerender_resource_test.mts"], testonly = True, deps = [ ":prerender_resource", @@ -83,12 +83,12 @@ jasmine_node_test( ts_project( name = "url_path", - srcs = ["url_path.ts"], + srcs = ["url_path.mts"], ) ts_project( name = "url_path_test_lib", - srcs = ["url_path_test.ts"], + srcs = ["url_path_test.mts"], testonly = True, deps = [ ":url_path", diff --git a/common/models/prerender_annotation.ts b/common/models/prerender_annotation.mts similarity index 100% rename from common/models/prerender_annotation.ts rename to common/models/prerender_annotation.mts diff --git a/common/models/prerender_annotation_mock.ts b/common/models/prerender_annotation_mock.mts similarity index 97% rename from common/models/prerender_annotation_mock.ts rename to common/models/prerender_annotation_mock.mts index 7ef4ed7c..e0b56d75 100644 --- a/common/models/prerender_annotation_mock.ts +++ b/common/models/prerender_annotation_mock.mts @@ -3,7 +3,7 @@ * @see /README.md#Mocking */ -import { PrerenderAnnotation, ScriptAnnotation, StyleAnnotation } from './prerender_annotation'; +import { PrerenderAnnotation, ScriptAnnotation, StyleAnnotation } from './prerender_annotation.mjs'; /** * Mocks a {@link PrerenderAnnotation} object. Since this type is a diff --git a/common/models/prerender_annotation_test.ts b/common/models/prerender_annotation_test.mts similarity index 99% rename from common/models/prerender_annotation_test.ts rename to common/models/prerender_annotation_test.mts index 24c0ce0f..36573f10 100644 --- a/common/models/prerender_annotation_test.ts +++ b/common/models/prerender_annotation_test.mts @@ -1,4 +1,4 @@ -import { PrerenderAnnotation, createAnnotation, parseAnnotation, ScriptAnnotation, annotationsEqual, StyleAnnotation } from './prerender_annotation'; +import { PrerenderAnnotation, createAnnotation, parseAnnotation, ScriptAnnotation, annotationsEqual, StyleAnnotation } from './prerender_annotation.mjs'; describe('prerender_annotation', () => { describe('PrerenderAnnotation', () => { diff --git a/common/models/prerender_metadata.ts b/common/models/prerender_metadata.mts similarity index 100% rename from common/models/prerender_metadata.ts rename to common/models/prerender_metadata.mts diff --git a/common/models/prerender_metadata_mock.ts b/common/models/prerender_metadata_mock.mts similarity index 98% rename from common/models/prerender_metadata_mock.ts rename to common/models/prerender_metadata_mock.mts index b83c2014..5a4eff24 100644 --- a/common/models/prerender_metadata_mock.ts +++ b/common/models/prerender_metadata_mock.mts @@ -3,7 +3,7 @@ * @see /README.md#Mocking */ -import { PrerenderMetadata, ScriptMetadata } from './prerender_metadata'; +import { PrerenderMetadata, ScriptMetadata } from './prerender_metadata.mjs'; /** Mocks the {@link PrerenderMetadata} object with the given overrides. */ export function mockPrerenderMetadata( diff --git a/common/models/prerender_metadata_test.ts b/common/models/prerender_metadata_test.mts similarity index 98% rename from common/models/prerender_metadata_test.ts rename to common/models/prerender_metadata_test.mts index c1222f50..c4da255a 100644 --- a/common/models/prerender_metadata_test.ts +++ b/common/models/prerender_metadata_test.mts @@ -1,4 +1,4 @@ -import { PrerenderMetadata, ScriptMetadata } from './prerender_metadata'; +import { PrerenderMetadata, ScriptMetadata } from './prerender_metadata.mjs'; describe('prerender_metadata', () => { describe('PrerenderMetadata', () => { diff --git a/common/models/prerender_resource.ts b/common/models/prerender_resource.mts similarity index 98% rename from common/models/prerender_resource.ts rename to common/models/prerender_resource.mts index 7c7bb99b..b57012ff 100644 --- a/common/models/prerender_resource.ts +++ b/common/models/prerender_resource.mts @@ -1,4 +1,4 @@ -import { UrlPath } from './url_path'; +import { UrlPath } from './url_path.mjs'; /** Represents a resource to be rendered / generated at a particular path. */ export class PrerenderResource { diff --git a/common/models/prerender_resource_test.ts b/common/models/prerender_resource_test.mts similarity index 96% rename from common/models/prerender_resource_test.ts rename to common/models/prerender_resource_test.mts index 28a091eb..35e048f8 100644 --- a/common/models/prerender_resource_test.ts +++ b/common/models/prerender_resource_test.mts @@ -1,4 +1,4 @@ -import { PrerenderResource } from './prerender_resource'; +import { PrerenderResource } from './prerender_resource.mjs'; describe('PrerenderResource', () => { describe('of()', () => { diff --git a/common/models/url_path.ts b/common/models/url_path.mts similarity index 100% rename from common/models/url_path.ts rename to common/models/url_path.mts diff --git a/common/models/url_path_test.ts b/common/models/url_path_test.mts similarity index 91% rename from common/models/url_path_test.ts rename to common/models/url_path_test.mts index c8e6fae3..b9ed2680 100644 --- a/common/models/url_path_test.ts +++ b/common/models/url_path_test.mts @@ -1,4 +1,4 @@ -import { UrlPath } from './url_path'; +import { UrlPath } from './url_path.mjs'; describe('UrlPath', () => { describe('of()', () => { diff --git a/common/prerender_annotation_walker.ts b/common/prerender_annotation_walker.mts similarity index 99% rename from common/prerender_annotation_walker.ts rename to common/prerender_annotation_walker.mts index d1a2014e..f28dbba4 100644 --- a/common/prerender_annotation_walker.ts +++ b/common/prerender_annotation_walker.mts @@ -1,5 +1,5 @@ import { CommentNode, HTMLElement, Node } from 'node-html-parser'; -import { parseAnnotation, PrerenderAnnotation } from './models/prerender_annotation'; +import { parseAnnotation, PrerenderAnnotation } from './models/prerender_annotation.mjs'; /** * A reference to a `node-html-parser` `Node` which contains a @@ -138,4 +138,4 @@ function* walk(node: Node, parent?: HTMLElement): yield* walk(child, node); } } -} \ No newline at end of file +} diff --git a/common/prerender_annotation_walker_test.ts b/common/prerender_annotation_walker_test.mts similarity index 98% rename from common/prerender_annotation_walker_test.ts rename to common/prerender_annotation_walker_test.mts index 885e5833..b57238b6 100644 --- a/common/prerender_annotation_walker_test.ts +++ b/common/prerender_annotation_walker_test.mts @@ -1,6 +1,6 @@ import { HTMLElement, parse } from 'node-html-parser'; -import { createAnnotation } from './models/prerender_annotation'; -import { walkAllAnnotations } from './prerender_annotation_walker'; +import { createAnnotation } from './models/prerender_annotation.mjs'; +import { walkAllAnnotations } from './prerender_annotation_walker.mjs'; describe('prerender_annotation_walker', () => { describe('walkAllAnnotations()', () => { diff --git a/common/probably.ts b/common/probably.mts similarity index 100% rename from common/probably.ts rename to common/probably.mts diff --git a/common/probably_test.ts b/common/probably_test.mts similarity index 96% rename from common/probably_test.ts rename to common/probably_test.mts index 2255fb42..a12c90ed 100644 --- a/common/probably_test.ts +++ b/common/probably_test.mts @@ -1,4 +1,4 @@ -import { definitely, Definitely, Probably } from './probably'; +import { definitely, Definitely, Probably } from './probably.mjs'; interface User { name: string; diff --git a/common/testing/BUILD.bazel b/common/testing/BUILD.bazel index 0246a84f..89e0a66a 100644 --- a/common/testing/BUILD.bazel +++ b/common/testing/BUILD.bazel @@ -4,7 +4,7 @@ load("//tools/typescript:defs.bzl", "ts_project") ts_project( name = "binary", - srcs = ["binary.ts"], + srcs = ["binary.mts"], testonly = True, visibility = ["//visibility:public"], deps = ["//:node_modules/@types/node"], @@ -12,7 +12,7 @@ ts_project( ts_project( name = "binary_test_lib", - srcs = ["binary_test.ts"], + srcs = ["binary_test.mts"], testonly = True, deps = [ ":binary", @@ -29,7 +29,7 @@ jasmine_node_test( ts_project( name = "devserver", - srcs = ["devserver.ts"], + srcs = ["devserver.mts"], testonly = True, visibility = ["//visibility:public"], data = [ @@ -49,7 +49,7 @@ ts_project( ts_project( name = "devserver_test_lib", - srcs = ["devserver_test.ts"], + srcs = ["devserver_test.mts"], testonly = True, data = ["//:node_modules/http-status-codes"], deps = [ @@ -84,7 +84,7 @@ jasmine_node_test( ts_project( name = "effects", - srcs = ["effects.ts"], + srcs = ["effects.mts"], testonly = True, deps = [ "//:node_modules/@types/jasmine", @@ -93,7 +93,7 @@ ts_project( ts_project( name = "effects_test_lib", - srcs = ["effects_test.ts"], + srcs = ["effects_test.mts"], testonly = True, deps = [ ":effects", @@ -108,7 +108,7 @@ jasmine_node_test( ts_project( name = "effect_fake", - srcs = ["effect_fake.ts"], + srcs = ["effect_fake.mts"], testonly = True, visibility = ["//visibility:public"], deps = [":effects"], @@ -116,7 +116,7 @@ ts_project( ts_project( name = "effect_fake_test_lib", - srcs = ["effect_fake_test.ts"], + srcs = ["effect_fake_test.mts"], testonly = True, deps = [ ":effects", @@ -132,7 +132,7 @@ jasmine_node_test( ts_project( name = "effect_tester", - srcs = ["effect_tester.ts"], + srcs = ["effect_tester.mts"], testonly = True, visibility = ["//visibility:public"], deps = [ @@ -143,7 +143,7 @@ ts_project( ts_project( name = "effect_tester_test_lib", - srcs = ["effect_tester_test.ts"], + srcs = ["effect_tester_test.mts"], testonly = True, deps = [ ":effects", @@ -160,7 +160,7 @@ jasmine_node_test( ts_project( name = "mocks", - srcs = ["mocks.ts"], + srcs = ["mocks.mts"], testonly = True, visibility = ["//visibility:public"], deps = ["//:node_modules/@types/jasmine"], @@ -168,7 +168,7 @@ ts_project( ts_project( name = "mocks_test_lib", - srcs = ["mocks_test.ts"], + srcs = ["mocks_test.mts"], testonly = True, deps = [ ":mocks", @@ -183,7 +183,7 @@ jasmine_node_test( ts_project( name = "temp_dir", - srcs = ["temp_dir.ts"], + srcs = ["temp_dir.mts"], testonly = True, visibility = ["//visibility:public"], deps = [ @@ -194,7 +194,7 @@ ts_project( ts_project( name = "temp_dir_test_lib", - srcs = ["temp_dir_test.ts"], + srcs = ["temp_dir_test.mts"], testonly = True, deps = [ ":temp_dir", @@ -211,13 +211,13 @@ jasmine_node_test( ts_project( name = "test_server", - srcs = ["test_server.ts"], + srcs = ["test_server.mts"], testonly = True, ) ts_project( name = "test_server_test_lib", - srcs = ["test_server_test.ts"], + srcs = ["test_server_test.mts"], testonly = True, deps = [ ":test_server", @@ -232,7 +232,7 @@ jasmine_node_test( ts_project( name = "webdriver", - srcs = ["webdriver.ts"], + srcs = ["webdriver.mts"], testonly = True, visibility = ["//visibility:public"], data = ["//:node_modules/webdriverio"], @@ -246,7 +246,7 @@ ts_project( ts_project( name = "webdriver_test_lib", - srcs = ["webdriver_test.ts"], + srcs = ["webdriver_test.mts"], testonly = True, deps = [ ":devserver", diff --git a/common/testing/binary.ts b/common/testing/binary.mts similarity index 100% rename from common/testing/binary.ts rename to common/testing/binary.mts diff --git a/common/testing/binary_test.ts b/common/testing/binary_test.mts similarity index 93% rename from common/testing/binary_test.ts rename to common/testing/binary_test.mts index 8ce7e7ce..9dd12ee1 100644 --- a/common/testing/binary_test.ts +++ b/common/testing/binary_test.mts @@ -1,6 +1,6 @@ import { promises as fs } from 'fs'; -import { execBinary } from './binary'; -import { useTempDir } from './temp_dir'; +import { execBinary } from './binary.mjs'; +import { useTempDir } from './temp_dir.mjs'; describe('binary', () => { const tmpDir = useTempDir(); diff --git a/common/testing/devserver.ts b/common/testing/devserver.mts similarity index 98% rename from common/testing/devserver.ts rename to common/testing/devserver.mts index 03c22d56..b8db61f0 100644 --- a/common/testing/devserver.ts +++ b/common/testing/devserver.mts @@ -4,9 +4,9 @@ import killTree from 'tree-kill'; import net from 'net'; import { URL } from 'url'; import { promisify } from 'util'; -import * as http from '../http'; -import { Effect, useForAll } from './effects'; -import { TestServer } from './test_server'; +import * as http from '../http.mjs'; +import { Effect, useForAll } from './effects.mjs'; +import { TestServer } from './test_server.mjs'; type Signal = Parameters[0]; const execFile = promisify(execFileCb); diff --git a/common/testing/devserver_test.ts b/common/testing/devserver_test.mts similarity index 94% rename from common/testing/devserver_test.ts rename to common/testing/devserver_test.mts index 115283c4..cf3888b3 100644 --- a/common/testing/devserver_test.ts +++ b/common/testing/devserver_test.mts @@ -1,8 +1,8 @@ import { URL } from 'url'; import { StatusCodes } from 'http-status-codes'; -import * as http from '../http'; -import { Server, useDevserver } from './devserver'; -import { EffectTester } from './effect_tester'; +import * as http from '../http.mjs'; +import { Server, useDevserver } from './devserver.mjs'; +import { EffectTester } from './effect_tester.mjs'; const devserver = 'common/testing/devserver_test_server.sh'; diff --git a/common/testing/effect_fake.ts b/common/testing/effect_fake.mts similarity index 89% rename from common/testing/effect_fake.ts rename to common/testing/effect_fake.mts index 7c6cfa28..ce552c71 100644 --- a/common/testing/effect_fake.ts +++ b/common/testing/effect_fake.mts @@ -1,4 +1,4 @@ -import { Effect } from './effects'; +import { Effect } from './effects.mjs'; /** * Creates a fake implementation of an {@link Effect} which holds the provided diff --git a/common/testing/effect_fake_test.ts b/common/testing/effect_fake_test.mts similarity index 85% rename from common/testing/effect_fake_test.ts rename to common/testing/effect_fake_test.mts index 43979f2c..e76f6420 100644 --- a/common/testing/effect_fake_test.ts +++ b/common/testing/effect_fake_test.mts @@ -1,5 +1,5 @@ -import { Effect } from './effects'; -import { effectFake } from './effect_fake'; +import { Effect } from './effects.mjs'; +import { effectFake } from './effect_fake.mjs'; describe('effect_fake', () => { describe('effectFake()', () => { diff --git a/common/testing/effect_tester.ts b/common/testing/effect_tester.mts similarity index 99% rename from common/testing/effect_tester.ts rename to common/testing/effect_tester.mts index 880b6478..e1791bc1 100644 --- a/common/testing/effect_tester.ts +++ b/common/testing/effect_tester.mts @@ -1,4 +1,4 @@ -import { Effect } from './effects'; +import { Effect } from './effects.mjs'; /** * Utility class for testing effects. diff --git a/common/testing/effect_tester_test.ts b/common/testing/effect_tester_test.mts similarity index 96% rename from common/testing/effect_tester_test.ts rename to common/testing/effect_tester_test.mts index a77ca476..9eba53fb 100644 --- a/common/testing/effect_tester_test.ts +++ b/common/testing/effect_tester_test.mts @@ -1,6 +1,6 @@ -import { useForEach } from './effects'; -import { effectFake } from './effect_fake'; -import { EffectTester } from './effect_tester'; +import { useForEach } from './effects.mjs'; +import { effectFake } from './effect_fake.mjs'; +import { EffectTester } from './effect_tester.mjs'; describe('EffectTester', () => { it('tests effects', async () => { diff --git a/common/testing/effects.ts b/common/testing/effects.mts similarity index 100% rename from common/testing/effects.ts rename to common/testing/effects.mts diff --git a/common/testing/effects_test.ts b/common/testing/effects_test.mts similarity index 98% rename from common/testing/effects_test.ts rename to common/testing/effects_test.mts index 0d1cad65..aa5789db 100644 --- a/common/testing/effects_test.ts +++ b/common/testing/effects_test.mts @@ -1,4 +1,4 @@ -import { useForAll, useForEach } from './effects'; +import { useForAll, useForEach } from './effects.mjs'; describe('effects', () => { describe('useForEach()', () => { diff --git a/common/testing/mocks.ts b/common/testing/mocks.mts similarity index 100% rename from common/testing/mocks.ts rename to common/testing/mocks.mts diff --git a/common/testing/mocks_test.ts b/common/testing/mocks_test.mts similarity index 96% rename from common/testing/mocks_test.ts rename to common/testing/mocks_test.mts index 3a766a63..7cbe1fcc 100644 --- a/common/testing/mocks_test.ts +++ b/common/testing/mocks_test.mts @@ -1,4 +1,4 @@ -import { unmockedFunc } from './mocks'; +import { unmockedFunc } from './mocks.mjs'; describe('mocks', () => { describe('unmockedFunc()', () => { diff --git a/common/testing/temp_dir.ts b/common/testing/temp_dir.mts similarity index 96% rename from common/testing/temp_dir.ts rename to common/testing/temp_dir.mts index 916cc40c..95a85f92 100644 --- a/common/testing/temp_dir.ts +++ b/common/testing/temp_dir.mts @@ -1,6 +1,6 @@ import { promises as fs } from 'fs'; import { env } from 'process'; -import { Effect, useForEach } from './effects'; +import { Effect, useForEach } from './effects.mjs'; /** * Creates an {@link Effect} of a temporary directory. The directory is deleted diff --git a/common/testing/temp_dir_test.ts b/common/testing/temp_dir_test.mts similarity index 92% rename from common/testing/temp_dir_test.ts rename to common/testing/temp_dir_test.mts index 18d56502..dad9d267 100644 --- a/common/testing/temp_dir_test.ts +++ b/common/testing/temp_dir_test.mts @@ -1,6 +1,6 @@ import { env } from 'process'; -import { useTempDir } from './temp_dir'; -import { EffectTester } from './effect_tester'; +import { useTempDir } from './temp_dir.mjs'; +import { EffectTester } from './effect_tester.mjs'; const originalTempDir = env['TEST_TMPDIR']; describe('temp_dir', () => { diff --git a/common/testing/test_server.ts b/common/testing/test_server.mts similarity index 100% rename from common/testing/test_server.ts rename to common/testing/test_server.mts diff --git a/common/testing/test_server_test.ts b/common/testing/test_server_test.mts similarity index 93% rename from common/testing/test_server_test.ts rename to common/testing/test_server_test.mts index 9c376448..e30e98c1 100644 --- a/common/testing/test_server_test.ts +++ b/common/testing/test_server_test.mts @@ -1,4 +1,4 @@ -import { TestServer } from './test_server'; +import { TestServer } from './test_server.mjs'; describe('test_server', () => { describe('TestServer', () => { diff --git a/common/testing/webdriver.ts b/common/testing/webdriver.mts similarity index 97% rename from common/testing/webdriver.ts rename to common/testing/webdriver.mts index 5cb355fe..24f49dc7 100644 --- a/common/testing/webdriver.ts +++ b/common/testing/webdriver.mts @@ -4,8 +4,8 @@ import { remote, ChainablePromiseElement } from 'webdriverio'; import { env } from 'process'; -import { Effect, useForAll } from './effects'; -import { TestServer } from './test_server'; +import { Effect, useForAll } from './effects.mjs'; +import { TestServer } from './test_server.mjs'; /** * Default timeout value to use for WebDriver tests. They can be quite resource diff --git a/common/testing/webdriver_test.ts b/common/testing/webdriver_test.mts similarity index 90% rename from common/testing/webdriver_test.ts rename to common/testing/webdriver_test.mts index 3af76560..3d79f549 100644 --- a/common/testing/webdriver_test.ts +++ b/common/testing/webdriver_test.mts @@ -1,6 +1,6 @@ -import { useDevserver } from './devserver'; -import { EffectTester } from './effect_tester'; -import { useWebDriver, webDriverTestTimeout } from './webdriver'; +import { useDevserver } from './devserver.mjs'; +import { EffectTester } from './effect_tester.mjs'; +import { useWebDriver, webDriverTestTimeout } from './webdriver.mjs'; describe('webdriver', () => { describe('useWebDriver()', () => { diff --git a/examples/components/BUILD.bazel b/examples/components/BUILD.bazel index 7be6b26b..cabf7462 100644 --- a/examples/components/BUILD.bazel +++ b/examples/components/BUILD.bazel @@ -9,7 +9,7 @@ load("//tools/jasmine:defs.bzl", "jasmine_web_test_suite") prerender_pages( name = "page", - src = "page.ts", + src = "page.mts", tsconfig = "//:tsconfig", source_map = True, bundle_js = False, # Optimization: No client-side JavaScript on this page. @@ -19,7 +19,7 @@ prerender_pages( prerender_component( name = "component", - srcs = ["component.ts"], + srcs = ["component.mts"], tsconfig = "//:tsconfig", source_map = True, lib_deps = [":ts_dep"], @@ -28,12 +28,12 @@ prerender_component( ts_project( name = "ts_dep", - srcs = ["ts_dep.ts"], + srcs = ["ts_dep.mts"], ) prerender_component( name = "dep", - srcs = ["dep.ts"], + srcs = ["dep.mts"], tsconfig = "//:tsconfig", source_map = True, deps = [":transitive"], @@ -41,7 +41,7 @@ prerender_component( prerender_component( name = "transitive", - srcs = ["transitive.ts"], + srcs = ["transitive.mts"], tsconfig = "//:tsconfig", source_map = True, ) @@ -53,7 +53,7 @@ web_resources_devserver( ts_project( name = "test_lib", - srcs = ["test.ts"], + srcs = ["test.mts"], testonly = True, deps = [ "//common/testing:devserver", diff --git a/examples/components/component.ts b/examples/components/component.mts similarity index 83% rename from examples/components/component.ts rename to examples/components/component.mts index 9c406279..6cfd18b3 100644 --- a/examples/components/component.ts +++ b/examples/components/component.mts @@ -1,5 +1,5 @@ -import { tsDep } from './ts_dep'; -import { render as renderDep } from './dep'; +import { tsDep } from './ts_dep.mjs'; +import { render as renderDep } from './dep.mjs'; /** Prerenders this component using other components. */ export function render(): string { diff --git a/examples/components/dep.ts b/examples/components/dep.mts similarity index 79% rename from examples/components/dep.ts rename to examples/components/dep.mts index bddf8ead..d13dbe67 100644 --- a/examples/components/dep.ts +++ b/examples/components/dep.mts @@ -1,4 +1,4 @@ -import { render as renderTransitive } from './transitive'; +import { render as renderTransitive } from './transitive.mjs'; export function render(): string { return ` diff --git a/examples/components/page.ts b/examples/components/page.mts similarity index 88% rename from examples/components/page.ts rename to examples/components/page.mts index 9cba8fb6..a7bc4608 100644 --- a/examples/components/page.ts +++ b/examples/components/page.mts @@ -1,5 +1,5 @@ import { PrerenderResource } from 'rules_prerender'; -import { render as renderComponent } from './component'; +import { render as renderComponent } from './component.mjs'; /** Renders a page using components. */ export default function*(): Generator { diff --git a/examples/components/test.ts b/examples/components/test.mts similarity index 92% rename from examples/components/test.ts rename to examples/components/test.mts index 7c505751..2262d70a 100644 --- a/examples/components/test.ts +++ b/examples/components/test.mts @@ -1,5 +1,5 @@ -import { useDevserver } from '../../common/testing/devserver'; -import { useWebDriver, webDriverTestTimeout } from '../../common/testing/webdriver'; +import { useDevserver } from '../../common/testing/devserver.mjs'; +import { useWebDriver, webDriverTestTimeout } from '../../common/testing/webdriver.mjs'; describe('components', () => { const devserver = useDevserver('examples/components/devserver.sh'); diff --git a/examples/components/transitive.ts b/examples/components/transitive.mts similarity index 100% rename from examples/components/transitive.ts rename to examples/components/transitive.mts diff --git a/examples/components/ts_dep.ts b/examples/components/ts_dep.mts similarity index 100% rename from examples/components/ts_dep.ts rename to examples/components/ts_dep.mts diff --git a/examples/data/BUILD.bazel b/examples/data/BUILD.bazel index 643eefbc..0ef16c25 100644 --- a/examples/data/BUILD.bazel +++ b/examples/data/BUILD.bazel @@ -4,7 +4,7 @@ load("//tools/jasmine:defs.bzl", "jasmine_web_test_suite") prerender_pages( name = "pages", - src = "pages.ts", + src = "pages.mts", tsconfig = "//:tsconfig", source_map = True, data = glob(["content/*.txt"]), @@ -22,7 +22,7 @@ web_resources_devserver( ts_project( name = "test_lib", - srcs = ["test.ts"], + srcs = ["test.mts"], testonly = True, deps = [ "//common/testing:devserver", diff --git a/examples/data/pages.ts b/examples/data/pages.mts similarity index 100% rename from examples/data/pages.ts rename to examples/data/pages.mts diff --git a/examples/data/test.ts b/examples/data/test.mts similarity index 95% rename from examples/data/test.ts rename to examples/data/test.mts index 4d5c1816..177ed6ce 100644 --- a/examples/data/test.ts +++ b/examples/data/test.mts @@ -1,5 +1,5 @@ -import { useDevserver } from '../../common/testing/devserver'; -import { useWebDriver, webDriverTestTimeout } from '../../common/testing/webdriver'; +import { useDevserver } from '../../common/testing/devserver.mjs'; +import { useWebDriver, webDriverTestTimeout } from '../../common/testing/webdriver.mjs'; describe('data', () => { const devserver = useDevserver('examples/data/devserver.sh'); diff --git a/examples/declarative_shadow_dom/BUILD.bazel b/examples/declarative_shadow_dom/BUILD.bazel index 1d36c58c..2c8247b2 100644 --- a/examples/declarative_shadow_dom/BUILD.bazel +++ b/examples/declarative_shadow_dom/BUILD.bazel @@ -10,7 +10,7 @@ load("//tools/jasmine:defs.bzl", "jasmine_web_test_suite") prerender_pages( name = "site", - src = "site.ts", + src = "site.mts", tsconfig = "//:tsconfig", source_map = True, lib_deps = ["//:node_modules/rules_prerender"], @@ -19,7 +19,7 @@ prerender_pages( prerender_component( name = "component", - srcs = ["component.ts"], + srcs = ["component.mts"], tsconfig = "//:tsconfig", source_map = True, styles = [":styles"], @@ -39,7 +39,7 @@ web_resources_devserver( ts_project( name = "test_lib", - srcs = ["test.ts"], + srcs = ["test.mts"], data = [":devserver"], testonly = True, deps = [ diff --git a/examples/declarative_shadow_dom/component.ts b/examples/declarative_shadow_dom/component.mts similarity index 100% rename from examples/declarative_shadow_dom/component.ts rename to examples/declarative_shadow_dom/component.mts diff --git a/examples/declarative_shadow_dom/site.ts b/examples/declarative_shadow_dom/site.mts similarity index 90% rename from examples/declarative_shadow_dom/site.ts rename to examples/declarative_shadow_dom/site.mts index 34e527eb..e3672cce 100644 --- a/examples/declarative_shadow_dom/site.ts +++ b/examples/declarative_shadow_dom/site.mts @@ -1,5 +1,5 @@ import { PrerenderResource } from 'rules_prerender'; -import { renderComponent } from './component'; +import { renderComponent } from './component.mjs'; export default async function*(): AsyncGenerator { yield PrerenderResource.of('/index.html', ` diff --git a/examples/declarative_shadow_dom/test.ts b/examples/declarative_shadow_dom/test.mts similarity index 91% rename from examples/declarative_shadow_dom/test.ts rename to examples/declarative_shadow_dom/test.mts index 196594ff..4bd7b7b4 100644 --- a/examples/declarative_shadow_dom/test.ts +++ b/examples/declarative_shadow_dom/test.mts @@ -1,5 +1,5 @@ -import { useDevserver } from '../../common/testing/devserver'; -import { getColor, useWebDriver, webDriverTestTimeout } from '../../common/testing/webdriver'; +import { useDevserver } from '../../common/testing/devserver.mjs'; +import { getColor, useWebDriver, webDriverTestTimeout } from '../../common/testing/webdriver.mjs'; describe('Declarative Shadow DOM', () => { const devserver = useDevserver('examples/declarative_shadow_dom/devserver.sh'); diff --git a/examples/external/BUILD.bazel b/examples/external/BUILD.bazel index 14729cce..fcf1a8ea 100644 --- a/examples/external/BUILD.bazel +++ b/examples/external/BUILD.bazel @@ -43,7 +43,7 @@ ts_config( prerender_pages( name = "site", - src = "site.ts", + src = "site.mts", source_map = True, tsconfig = "//:tsconfig", lib_deps = ["//:node_modules/rules_prerender"], diff --git a/examples/external/component/BUILD.bazel b/examples/external/component/BUILD.bazel index 0ff2bc59..707264ba 100644 --- a/examples/external/component/BUILD.bazel +++ b/examples/external/component/BUILD.bazel @@ -8,7 +8,7 @@ load( prerender_component( name = "component", - srcs = ["component.ts"], + srcs = ["component.mts"], scripts = [":script"], styles = [":style"], resources = [":resources"], @@ -21,7 +21,7 @@ prerender_component( ts_project( name = "script", - srcs = ["script.ts"], + srcs = ["script.mts"], declaration = True, source_map = True, tsconfig = "//:tsconfig_client", diff --git a/examples/external/component/component.ts b/examples/external/component/component.mts similarity index 100% rename from examples/external/component/component.ts rename to examples/external/component/component.mts diff --git a/examples/external/component/script.ts b/examples/external/component/script.mts similarity index 100% rename from examples/external/component/script.ts rename to examples/external/component/script.mts diff --git a/examples/external/site.ts b/examples/external/site.mts similarity index 86% rename from examples/external/site.ts rename to examples/external/site.mts index dbb6e6e6..ee207235 100644 --- a/examples/external/site.ts +++ b/examples/external/site.mts @@ -1,5 +1,5 @@ import { PrerenderResource } from 'rules_prerender'; -import { renderComponent } from './component/component'; +import { renderComponent } from './component/component.mjs'; export default function*(): Generator { yield PrerenderResource.of('/index.html', ` diff --git a/examples/external/tsconfig.json b/examples/external/tsconfig.json index ec2b0998..a467a361 100644 --- a/examples/external/tsconfig.json +++ b/examples/external/tsconfig.json @@ -2,7 +2,8 @@ "exclude": ["**/dist/"], "compilerOptions": { "target": "ES2020", - "module": "CommonJS", + "module": "ES2020", + "moduleResolution": "node", "declaration": true, "sourceMap": true, "paths": { diff --git a/examples/extract/BUILD.bazel b/examples/extract/BUILD.bazel index 55d30ce1..8df291e6 100644 --- a/examples/extract/BUILD.bazel +++ b/examples/extract/BUILD.bazel @@ -3,7 +3,7 @@ load("//:index.bzl", "extract_single_resource", "prerender_pages_unbundled") prerender_pages_unbundled( name = "single_resource", - src = "single_resource.ts", + src = "single_resource.mts", tsconfig = "//:tsconfig", source_map = True, lib_deps = ["//:node_modules/rules_prerender"], @@ -23,7 +23,7 @@ diff_test( prerender_pages_unbundled( name = "nested_resource", - src = "nested_resource.ts", + src = "nested_resource.mts", tsconfig = "//:tsconfig", source_map = True, lib_deps = ["//:node_modules/rules_prerender"], diff --git a/examples/extract/nested_resource.ts b/examples/extract/nested_resource.mts similarity index 100% rename from examples/extract/nested_resource.ts rename to examples/extract/nested_resource.mts diff --git a/examples/extract/single_resource.ts b/examples/extract/single_resource.mts similarity index 100% rename from examples/extract/single_resource.ts rename to examples/extract/single_resource.mts diff --git a/examples/javascript/BUILD.bazel b/examples/javascript/BUILD.bazel index 39dd371e..5c407ec2 100644 --- a/examples/javascript/BUILD.bazel +++ b/examples/javascript/BUILD.bazel @@ -4,7 +4,7 @@ load("//tools/jasmine:defs.bzl", "jasmine_web_test_suite") prerender_pages( name = "page", - src = "page.js", + src = "page.mjs", lib_deps = ["//:node_modules/rules_prerender"], deps = ["//examples/javascript/component"], ) @@ -16,7 +16,7 @@ web_resources_devserver( ts_project( name = "test_lib", - srcs = ["test.ts"], + srcs = ["test.mts"], testonly = True, deps = [ "//common/testing:devserver", diff --git a/examples/javascript/component/BUILD.bazel b/examples/javascript/component/BUILD.bazel index d24b86a7..4298ce2a 100644 --- a/examples/javascript/component/BUILD.bazel +++ b/examples/javascript/component/BUILD.bazel @@ -3,7 +3,7 @@ load("//:index.bzl", "prerender_component") prerender_component( name = "component", - srcs = ["component.js"], + srcs = ["component.mjs"], lib_deps = [ ":prerender_lib", "//:node_modules/rules_prerender", @@ -17,21 +17,21 @@ prerender_component( js_library( name = "prerender_lib", - srcs = ["prerender_lib.js"], + srcs = ["prerender_lib.mjs"], ) js_library( name = "component_script", - srcs = ["component_script.js"], + srcs = ["component_script.mjs"], deps = [":component_script_dep"], ) js_library( name = "component_script_dep", - srcs = ["component_script_dep.js"], + srcs = ["component_script_dep.mjs"], ) js_library( name = "component_script_unused", - srcs = ["component_script_unused.js"], + srcs = ["component_script_unused.mjs"], ) diff --git a/examples/javascript/component/component.js b/examples/javascript/component/component.mjs similarity index 73% rename from examples/javascript/component/component.js rename to examples/javascript/component/component.mjs index 143ef06e..30cd39ba 100644 --- a/examples/javascript/component/component.js +++ b/examples/javascript/component/component.mjs @@ -1,8 +1,8 @@ -const { includeScript } = require('rules_prerender'); -const { content } = require('./prerender_lib'); +import { includeScript } from 'rules_prerender'; +import { content } from './prerender_lib.mjs'; /** Renders an example component with a script. */ -function renderComponent() { +export function renderComponent() { return `
${content}
@@ -16,11 +16,9 @@ ${includeScript('examples/javascript/component/component_script')} * Renders an example component with a script. This is never called and should * not be seen in the output. Used to validate tree-shaking of JS scripts. */ -function renderUnused() { +export function renderUnused() { return `
ERROR: Should never be rendered.
${includeScript('examples/javascript/component/component_script_unused')} `.trim(); } - -module.exports = { renderComponent, renderUnused }; diff --git a/examples/javascript/component/component_script.js b/examples/javascript/component/component_script.mjs similarity index 100% rename from examples/javascript/component/component_script.js rename to examples/javascript/component/component_script.mjs diff --git a/examples/javascript/component/component_script_dep.js b/examples/javascript/component/component_script_dep.mjs similarity index 100% rename from examples/javascript/component/component_script_dep.js rename to examples/javascript/component/component_script_dep.mjs diff --git a/examples/javascript/component/component_script_unused.js b/examples/javascript/component/component_script_unused.mjs similarity index 100% rename from examples/javascript/component/component_script_unused.js rename to examples/javascript/component/component_script_unused.mjs diff --git a/examples/javascript/component/prerender_lib.js b/examples/javascript/component/prerender_lib.mjs similarity index 51% rename from examples/javascript/component/prerender_lib.js rename to examples/javascript/component/prerender_lib.mjs index d58023e0..e9057927 100644 --- a/examples/javascript/component/prerender_lib.js +++ b/examples/javascript/component/prerender_lib.mjs @@ -1,5 +1,3 @@ /** @fileoverview JS file to be used as a dependency of a prerender library. */ -const content = 'Hello from a JS component!'; - -module.exports = { content }; +export const content = 'Hello from a JS component!'; diff --git a/examples/javascript/page.js b/examples/javascript/page.mjs similarity index 65% rename from examples/javascript/page.js rename to examples/javascript/page.mjs index 784e0a63..ef257f57 100644 --- a/examples/javascript/page.js +++ b/examples/javascript/page.mjs @@ -1,8 +1,8 @@ -const { PrerenderResource } = require('rules_prerender'); -const { renderComponent } = require('./component/component'); +import { PrerenderResource } from 'rules_prerender'; +import { renderComponent } from './component/component.mjs'; /* Renders the page. */ -module.exports = function*() { +export default function* () { yield PrerenderResource.of('/index.html', ` @@ -16,4 +16,4 @@ module.exports = function*() { `.trim()); -}; +} diff --git a/examples/javascript/test.ts b/examples/javascript/test.mts similarity index 87% rename from examples/javascript/test.ts rename to examples/javascript/test.mts index d98171c1..4c0cc25c 100644 --- a/examples/javascript/test.ts +++ b/examples/javascript/test.mts @@ -1,5 +1,5 @@ -import { useDevserver } from '../../common/testing/devserver'; -import { useWebDriver, webDriverTestTimeout } from '../../common/testing/webdriver'; +import { useDevserver } from '../../common/testing/devserver.mjs'; +import { useWebDriver, webDriverTestTimeout } from '../../common/testing/webdriver.mjs'; describe('JavaScript', () => { const devserver = useDevserver('examples/javascript/devserver.sh'); diff --git a/examples/minimal/BUILD.bazel b/examples/minimal/BUILD.bazel index ba4a4c8a..68b2db77 100644 --- a/examples/minimal/BUILD.bazel +++ b/examples/minimal/BUILD.bazel @@ -4,7 +4,7 @@ load("//tools/jasmine:defs.bzl", "jasmine_web_test_suite") prerender_pages( name = "page", - src = "page.ts", + src = "page.mts", tsconfig = "//:tsconfig", source_map = True, bundle_js = False, # Optimization: No client-side JavaScript on this page. @@ -16,13 +16,13 @@ prerender_pages( ts_project( name = "dep", - srcs = ["dep.ts"], + srcs = ["dep.mts"], deps = [":transitive"], ) ts_project( name = "transitive", - srcs = ["transitive.ts"], + srcs = ["transitive.mts"], ) web_resources_devserver( @@ -32,7 +32,7 @@ web_resources_devserver( ts_project( name = "test_lib", - srcs = ["test.ts"], + srcs = ["test.mts"], testonly = True, deps = [ "//common/testing:devserver", diff --git a/examples/minimal/dep.ts b/examples/minimal/dep.mts similarity index 70% rename from examples/minimal/dep.ts rename to examples/minimal/dep.mts index d066fbfe..b29fd9b6 100644 --- a/examples/minimal/dep.ts +++ b/examples/minimal/dep.mts @@ -2,4 +2,4 @@ export const foo = 'foo'; // Re-export a transitive dependency. -export { bar } from './transitive'; +export { bar } from './transitive.mjs'; diff --git a/examples/minimal/page.ts b/examples/minimal/page.mts similarity index 93% rename from examples/minimal/page.ts rename to examples/minimal/page.mts index 783f1683..9eeaea25 100644 --- a/examples/minimal/page.ts +++ b/examples/minimal/page.mts @@ -1,4 +1,4 @@ -import { bar, foo } from './dep'; +import { bar, foo } from './dep.mjs'; import { PrerenderResource } from 'rules_prerender'; /** Renders the page. */ diff --git a/examples/minimal/test.ts b/examples/minimal/test.mts similarity index 86% rename from examples/minimal/test.ts rename to examples/minimal/test.mts index 49a9d255..7cbb475b 100644 --- a/examples/minimal/test.ts +++ b/examples/minimal/test.mts @@ -1,5 +1,5 @@ -import { useDevserver } from '../../common/testing/devserver'; -import { useWebDriver, webDriverTestTimeout } from '../../common/testing/webdriver'; +import { useDevserver } from '../../common/testing/devserver.mjs'; +import { useWebDriver, webDriverTestTimeout } from '../../common/testing/webdriver.mjs'; describe('minimal', () => { const devserver = useDevserver('examples/minimal/devserver.sh'); diff --git a/examples/minimal/transitive.ts b/examples/minimal/transitive.mts similarity index 100% rename from examples/minimal/transitive.ts rename to examples/minimal/transitive.mts diff --git a/examples/multi_page/BUILD.bazel b/examples/multi_page/BUILD.bazel index 79cde98f..7b31c79f 100644 --- a/examples/multi_page/BUILD.bazel +++ b/examples/multi_page/BUILD.bazel @@ -10,7 +10,7 @@ load("//tools/jasmine:defs.bzl", "jasmine_web_test_suite") prerender_pages( name = "pages", - src = "pages.ts", + src = "pages.mts", tsconfig = "//:tsconfig", source_map = True, lib_deps = ["//:node_modules/rules_prerender"], @@ -26,7 +26,7 @@ css_library( ts_project( name = "script", - srcs = ["script.ts"], + srcs = ["script.mts"], tsconfig = "//:tsconfig_client", ) @@ -44,7 +44,7 @@ web_resources_devserver( ts_project( name = "test_lib", - srcs = ["test.ts"], + srcs = ["test.mts"], testonly = True, deps = [ "//common/testing:devserver", diff --git a/examples/multi_page/pages.ts b/examples/multi_page/pages.mts similarity index 100% rename from examples/multi_page/pages.ts rename to examples/multi_page/pages.mts diff --git a/examples/multi_page/script.ts b/examples/multi_page/script.mts similarity index 100% rename from examples/multi_page/script.ts rename to examples/multi_page/script.mts diff --git a/examples/multi_page/test.ts b/examples/multi_page/test.mts similarity index 96% rename from examples/multi_page/test.ts rename to examples/multi_page/test.mts index 9861df83..bcad379c 100644 --- a/examples/multi_page/test.ts +++ b/examples/multi_page/test.mts @@ -1,5 +1,5 @@ -import { useDevserver } from '../../common/testing/devserver'; -import { getColor, useWebDriver, webDriverTestTimeout } from '../../common/testing/webdriver'; +import { useDevserver } from '../../common/testing/devserver.mjs'; +import { getColor, useWebDriver, webDriverTestTimeout } from '../../common/testing/webdriver.mjs'; describe('multi_page', () => { const devserver = useDevserver('examples/multi_page/devserver.sh'); diff --git a/examples/prerender_resources/BUILD.bazel b/examples/prerender_resources/BUILD.bazel index a36f3145..086d3b7c 100644 --- a/examples/prerender_resources/BUILD.bazel +++ b/examples/prerender_resources/BUILD.bazel @@ -4,19 +4,19 @@ load("//tools/jasmine:defs.bzl", "jasmine_node_test") ts_project( name = "generator", - srcs = ["generator.ts"], + srcs = ["generator.mts"], deps = ["//:node_modules/rules_prerender"], ) prerender_resources( name = "prerender", - entry_point = "./generator.js", + entry_point = "./generator.mjs", data = [":generator"], ) ts_project( name = "generator_test", - srcs = ["generator_test.ts"], + srcs = ["generator_test.mts"], testonly = True, data = [":prerender"], deps = [ diff --git a/examples/prerender_resources/generator.ts b/examples/prerender_resources/generator.mts similarity index 100% rename from examples/prerender_resources/generator.ts rename to examples/prerender_resources/generator.mts diff --git a/examples/prerender_resources/generator_test.ts b/examples/prerender_resources/generator_test.mts similarity index 100% rename from examples/prerender_resources/generator_test.ts rename to examples/prerender_resources/generator_test.mts diff --git a/examples/resources/BUILD.bazel b/examples/resources/BUILD.bazel index 83f7f030..c40b5966 100644 --- a/examples/resources/BUILD.bazel +++ b/examples/resources/BUILD.bazel @@ -9,7 +9,7 @@ load("//tools/jasmine:defs.bzl", "jasmine_web_test_suite") prerender_pages( name = "page", - src = "page.ts", + src = "page.mts", tsconfig = "//:tsconfig", source_map = True, bundle_js = False, # Optimization: No client-side JavaScript on this page. @@ -36,7 +36,7 @@ web_resources_devserver( ts_project( name = "test_lib", - srcs = ["test.ts"], + srcs = ["test.mts"], testonly = True, deps = [ "//common/testing:devserver", diff --git a/examples/resources/component/BUILD.bazel b/examples/resources/component/BUILD.bazel index 4d1109a3..a263f99f 100644 --- a/examples/resources/component/BUILD.bazel +++ b/examples/resources/component/BUILD.bazel @@ -3,7 +3,7 @@ load("//:index.bzl", "prerender_component", "web_resources") prerender_component( name = "component", - srcs = ["component.ts"], + srcs = ["component.mts"], tsconfig = "//:tsconfig", source_map = True, resources = [":resources"], diff --git a/examples/resources/component/component.ts b/examples/resources/component/component.mts similarity index 78% rename from examples/resources/component/component.ts rename to examples/resources/component/component.mts index 1e493470..37c08008 100644 --- a/examples/resources/component/component.ts +++ b/examples/resources/component/component.mts @@ -1,4 +1,4 @@ -import { renderTransitive } from '../transitive/transitive'; +import { renderTransitive } from '../transitive/transitive.mjs'; export function renderComponent(): string { return ` diff --git a/examples/resources/page.ts b/examples/resources/page.mts similarity index 88% rename from examples/resources/page.ts rename to examples/resources/page.mts index d11b2c76..47e2e01a 100644 --- a/examples/resources/page.ts +++ b/examples/resources/page.mts @@ -1,6 +1,6 @@ import { PrerenderResource } from 'rules_prerender'; -import { renderComponent } from './component/component'; -import { renderTransitive } from './transitive/transitive'; +import { renderComponent } from './component/component.mjs'; +import { renderTransitive } from './transitive/transitive.mjs'; export default function*(): Generator { yield PrerenderResource.of('/index.html', ` diff --git a/examples/resources/test.ts b/examples/resources/test.mts similarity index 91% rename from examples/resources/test.ts rename to examples/resources/test.mts index 20491a81..df865848 100644 --- a/examples/resources/test.ts +++ b/examples/resources/test.mts @@ -1,5 +1,5 @@ -import { useDevserver } from '../../common/testing/devserver'; -import { useWebDriver, webDriverTestTimeout } from '../../common/testing/webdriver'; +import { useDevserver } from '../../common/testing/devserver.mjs'; +import { useWebDriver, webDriverTestTimeout } from '../../common/testing/webdriver.mjs'; describe('resources', () => { const devserver = useDevserver('examples/resources/devserver.sh'); diff --git a/examples/resources/transitive/BUILD.bazel b/examples/resources/transitive/BUILD.bazel index 54cc73af..c04c6c99 100644 --- a/examples/resources/transitive/BUILD.bazel +++ b/examples/resources/transitive/BUILD.bazel @@ -2,7 +2,7 @@ load("//:index.bzl", "prerender_component", "web_resources") prerender_component( name = "transitive", - srcs = ["transitive.ts"], + srcs = ["transitive.mts"], tsconfig = "//:tsconfig", source_map = True, resources = [":resources"], diff --git a/examples/resources/transitive/transitive.ts b/examples/resources/transitive/transitive.mts similarity index 100% rename from examples/resources/transitive/transitive.ts rename to examples/resources/transitive/transitive.mts diff --git a/examples/script_isolation/BUILD.bazel b/examples/script_isolation/BUILD.bazel index 783641ef..8c98797c 100644 --- a/examples/script_isolation/BUILD.bazel +++ b/examples/script_isolation/BUILD.bazel @@ -4,7 +4,7 @@ load("//tools/jasmine:defs.bzl", "jasmine_web_test_suite") prerender_pages( name = "site", - src = "site.ts", + src = "site.mts", scripts = [":foo", ":bar"], tsconfig = "//:tsconfig", source_map = True, @@ -13,13 +13,13 @@ prerender_pages( ts_project( name = "foo", - srcs = ["foo.ts"], + srcs = ["foo.mts"], tsconfig = "//:tsconfig_client", ) ts_project( name = "bar", - srcs = ["bar.ts"], + srcs = ["bar.mts"], tsconfig = "//:tsconfig_client", ) @@ -30,7 +30,7 @@ web_resources_devserver( ts_project( name = "test_lib", - srcs = ["test.ts"], + srcs = ["test.mts"], testonly = True, deps = [ "//:node_modules/@types/jasmine", diff --git a/examples/script_isolation/bar.ts b/examples/script_isolation/bar.mts similarity index 100% rename from examples/script_isolation/bar.ts rename to examples/script_isolation/bar.mts diff --git a/examples/script_isolation/foo.ts b/examples/script_isolation/foo.mts similarity index 100% rename from examples/script_isolation/foo.ts rename to examples/script_isolation/foo.mts diff --git a/examples/script_isolation/site.ts b/examples/script_isolation/site.mts similarity index 100% rename from examples/script_isolation/site.ts rename to examples/script_isolation/site.mts diff --git a/examples/script_isolation/test.ts b/examples/script_isolation/test.mts similarity index 93% rename from examples/script_isolation/test.ts rename to examples/script_isolation/test.mts index 3c31350b..b731c56f 100644 --- a/examples/script_isolation/test.ts +++ b/examples/script_isolation/test.mts @@ -1,5 +1,5 @@ -import { useDevserver } from '../../common/testing/devserver'; -import { useWebDriver, webDriverTestTimeout } from '../../common/testing/webdriver'; +import { useDevserver } from '../../common/testing/devserver.mjs'; +import { useWebDriver, webDriverTestTimeout } from '../../common/testing/webdriver.mjs'; describe('Script Isolation', () => { const devserver = useDevserver('examples/script_isolation/devserver.sh'); diff --git a/examples/scripts/BUILD.bazel b/examples/scripts/BUILD.bazel index f5ea8bbb..032b0e61 100644 --- a/examples/scripts/BUILD.bazel +++ b/examples/scripts/BUILD.bazel @@ -4,7 +4,7 @@ load("//tools/jasmine:defs.bzl", "jasmine_web_test_suite") prerender_pages( name = "page", - src = "page.ts", + src = "page.mts", tsconfig = "//:tsconfig", source_map = True, lib_deps = ["//:node_modules/rules_prerender"], @@ -14,7 +14,7 @@ prerender_pages( ts_project( name = "script", - srcs = ["script.ts"], + srcs = ["script.mts"], tsconfig = "//:tsconfig_client", ) @@ -25,7 +25,7 @@ web_resources_devserver( ts_project( name = "test_lib", - srcs = ["test.ts"], + srcs = ["test.mts"], testonly = True, deps = [ "//common/testing:devserver", diff --git a/examples/scripts/component/BUILD.bazel b/examples/scripts/component/BUILD.bazel index bf1013fb..cbc6d8e5 100644 --- a/examples/scripts/component/BUILD.bazel +++ b/examples/scripts/component/BUILD.bazel @@ -3,7 +3,7 @@ load("//:index.bzl", "prerender_component") prerender_component( name = "component", - srcs = ["component.ts"], + srcs = ["component.mts"], tsconfig = "//:tsconfig", source_map = True, lib_deps = ["//:node_modules/rules_prerender"], @@ -14,6 +14,6 @@ prerender_component( ts_project( name = "component_script", - srcs = ["component_script.ts"], + srcs = ["component_script.mts"], tsconfig = "//:tsconfig_client", ) diff --git a/examples/scripts/component/component.ts b/examples/scripts/component/component.mts similarity index 87% rename from examples/scripts/component/component.ts rename to examples/scripts/component/component.mts index 54a6e280..4d4fc942 100644 --- a/examples/scripts/component/component.ts +++ b/examples/scripts/component/component.mts @@ -1,5 +1,5 @@ import { includeScript } from 'rules_prerender'; -import { renderTransitive } from '../transitive/transitive'; +import { renderTransitive } from '../transitive/transitive.mjs'; /** Renders HTML which expects a JavaScript library to be included. */ export function renderComponent(): string { diff --git a/examples/scripts/component/component_script.ts b/examples/scripts/component/component_script.mts similarity index 100% rename from examples/scripts/component/component_script.ts rename to examples/scripts/component/component_script.mts diff --git a/examples/scripts/page.ts b/examples/scripts/page.mts similarity index 91% rename from examples/scripts/page.ts rename to examples/scripts/page.mts index a5e3f117..6d14d3d1 100644 --- a/examples/scripts/page.ts +++ b/examples/scripts/page.mts @@ -1,5 +1,5 @@ import { PrerenderResource, includeScript } from 'rules_prerender'; -import { renderComponent } from './component/component'; +import { renderComponent } from './component/component.mjs'; /** Render some HTML with a `