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

Rename dev runtime to browser #8400

Merged
merged 8 commits into from
Jun 19, 2024
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
4 changes: 2 additions & 2 deletions crates/turbopack-cli/js/src/entry/client.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { connect } from "@vercel/turbopack-ecmascript-runtime/dev/client/hmr-client";
import { connect } from "@vercel/turbopack-ecmascript-runtime/browser/dev/hmr-client/hmr-client";
import {
connectHMR,
addMessageListener,
sendMessage,
} from "@vercel/turbopack-ecmascript-runtime/dev/client/websocket";
} from "@vercel/turbopack-ecmascript-runtime/browser/dev/hmr-client/websocket";

export function initializeHMR(options: { assetPrefix: string }) {
connect({
Expand Down
8 changes: 4 additions & 4 deletions crates/turbopack-ecmascript-runtime/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"scripts": {
"check": "run-p check:*",
"check:nodejs": "tsc -p src/nodejs",
"check:dev-client": "tsc -p src/dev/client",
"check:dev-runtime-base": "tsc -p src/dev/runtime/base",
"check:dev-runtime-dom": "tsc -p src/dev/runtime/dom",
"check:dev-runtime-edge": "tsc -p src/dev/runtime/edge"
"check:browser-dev-client": "tsc -p src/browser/dev/hmr-client",
"check:browser-dev-runtime-base": "tsc -p src/browser/dev/runtime/base",
"check:browser-dev-runtime-dom": "tsc -p src/browser/dev/runtime/dom",
"check:browser-dev-runtime-edge": "tsc -p src/browser/dev/runtime/edge"
},
"exports": {
".": "./src/main.js",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// <reference path="../../shared/runtime-types.d.ts" />
/// <reference path="../../../shared/runtime-types.d.ts" />
/// <reference path="../runtime/base/globals.d.ts" />
sokra marked this conversation as resolved.
Show resolved Hide resolved
/// <reference path="../runtime/base/protocol.d.ts" />
/// <reference path="../runtime/base/extensions.d.ts" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"skipLibCheck": true,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* This interface will be implemented by runtime backends.
*/

/// <reference path="../../../shared/require-type.d.ts" />
/// <reference path="../../../../shared/require-type.d.ts" />

declare var BACKEND: RuntimeBackend;
declare var _eval: (code: EcmascriptModuleEntry) => any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

/* eslint-disable @next/next/no-assign-module-variable */

/// <reference path="../../../shared/runtime-utils.ts" />
/// <reference path="../../../../shared/runtime-utils.ts" />
/// <reference path="./globals.d.ts" />
/// <reference path="./protocol.d.ts" />
/// <reference path="./extensions.d.ts" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
// environment, we need WebWorker for WebAssembly types
"lib": ["ESNext", "WebWorker"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

/// <reference path="../base/runtime-base.ts" />
/// <reference path="../../../shared/require-type.d.ts" />
/// <reference path="../../../../shared/require-type.d.ts" />

type ChunkResolver = {
resolved: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
// environment
"lib": ["ESNext", "DOM"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/

/// <reference path="../base/runtime-base.ts" />
/// <reference path="../../../shared-node/base-externals-utils.ts" />
/// <reference path="../../../shared/require-type.d.ts" />
/// <reference path="../../../../shared-node/base-externals-utils.ts" />
/// <reference path="../../../../shared/require-type.d.ts" />

type ChunkRunner = {
requiredChunks: Set<ChunkPath>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
// environment, we need WebWorker for WebAssembly types
"lib": ["ESNext", "WebWorker"]
Expand Down
10 changes: 6 additions & 4 deletions crates/turbopack-ecmascript-runtime/src/browser_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ pub async fn get_browser_runtime_code(

let shared_runtime_utils_code =
embed_static_code(asset_context, "shared/runtime-utils.ts".into());
let runtime_base_code =
embed_static_code(asset_context, "dev/runtime/base/runtime-base.ts".into());
let runtime_base_code = embed_static_code(
asset_context,
"browser/dev/runtime/base/runtime-base.ts".into(),
);

let chunk_loading = &*asset_context
.compile_time_info()
Expand All @@ -35,12 +37,12 @@ pub async fn get_browser_runtime_code(
let runtime_backend_code = embed_static_code(
asset_context,
match chunk_loading {
ChunkLoading::Edge => "dev/runtime/edge/runtime-backend-edge.ts".into(),
ChunkLoading::Edge => "browser/dev/runtime/edge/runtime-backend-edge.ts".into(),
// This case should never be hit.
ChunkLoading::NodeJs => {
panic!("Node.js runtime is not supported in the browser runtime!")
}
ChunkLoading::Dom => "dev/runtime/dom/runtime-backend-dom.ts".into(),
ChunkLoading::Dom => "browser/dev/runtime/dom/runtime-backend-dom.ts".into(),
},
);

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Loading