Skip to content

Commit

Permalink
Rename dev runtime to browser (vercel/turborepo#8400)
Browse files Browse the repository at this point in the history
### Description

Builds on top of earlier changes, renames "dev" to "browser" to mirror earlier changes to reflect reality.

<!--
  ✍️ Write a short summary of your work.
  If necessary, include relevant screenshots.
-->

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->
  • Loading branch information
timneutkens authored Jun 19, 2024
1 parent 76b6ce0 commit 12eb957
Show file tree
Hide file tree
Showing 19 changed files with 26 additions and 24 deletions.
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" />
/// <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.

0 comments on commit 12eb957

Please sign in to comment.