Skip to content

Commit cf73b8a

Browse files
authored
chore: package @packages/network as an independent bundle (#32633)
* chore: refactor network into two packages, network and network-tools. network-tools is expected to be used in simple environments, where network is intended to be used in the node context. additionally, makes these packages bundable and removes the ts-node entrypoint to make ESM possible. * chore: sync cloud validations after building packages as the network libs are needed * chore: fix cloud specs * remove building packages for requiring build step for creating publish artifacts * update ts-ignores with reasoning and fix cookie bug (though it shouldn't do this by reference * bump cache * update pull-request job as well
1 parent 8145f4f commit cf73b8a

Some content is hidden

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

72 files changed

+547
-313
lines changed

.circleci/cache-version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Bump this version to force CI to re-create the cache from scratch.
2-
10-9-2025
2+
10-10-2025

.circleci/src/pipeline/@pipeline.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,15 @@ commands:
195195
description: Save entire folder as artifact for other jobs to run without reinstalling
196196
steps:
197197
- run:
198-
name: Sync Cloud Validations
198+
name: Build packages
199199
command: |
200200
source ./scripts/ensure-node.sh
201-
yarn gulp syncCloudValidations
201+
yarn build
202202
- run:
203-
name: Build packages
203+
name: Sync Cloud Validations
204204
command: |
205205
source ./scripts/ensure-node.sh
206-
yarn build
206+
yarn gulp syncCloudValidations
207207
- run:
208208
name: Generate v8 snapshot
209209
command: |

.circleci/src/pipeline/workflows/@main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ linux-x64:
320320
- test-runner:build-binary
321321
- publish-binary
322322
requires:
323-
- node_modules_install
323+
- build
324324
- wait-for-binary-publish:
325325
type: approval
326326
requires:
@@ -837,7 +837,7 @@ linux-arm64:
837837
executor: linux-arm64
838838
resource_class: arm.medium
839839
requires:
840-
- linux-arm64-node-modules-install
840+
- linux-arm64-build
841841

842842
- wait-for-binary-publish:
843843
name: linux-arm64-wait-for-binary-publish

.circleci/src/pipeline/workflows/pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ jobs:
261261
- test-runner:build-binary
262262
- publish-binary
263263
requires:
264-
- node_modules_install
264+
- build
265265
- wait-for-binary-publish:
266266
type: approval
267267
requires:

guides/esm-migration.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ When migrating some of these projects away from the `ts-node` entry [see `@packa
5252
- [x] packages/launcher ✅ **COMPLETED**
5353
- [x] packages/launchpad ✅ **COMPLETED**
5454
- [x] packages/net-stubbing ✅ **COMPLETED**
55-
- [ ] packages/network **PARTIAL** - entry point is JS
55+
- [x] packages/network ✅ **COMPLETED**
56+
- [x] packages/network-tools ✅ **COMPLETED**
5657
- [x] packages/packherd-require ✅ **COMPLETED**
5758
- [ ] packages/proxy **PARTIAL** - entry point is JS
5859
- [x] packages/reporter ✅ **COMPLETED**
@@ -101,6 +102,7 @@ When migrating some of these projects away from the `ts-node` entry [see `@packa
101102
- [x] packages/launcher ✅ **COMPLETED**
102103
- [ ] packages/net-stubbing
103104
- [x] packages/network ✅ **COMPLETED**
105+
- [x] packages/network-tools ✅ **COMPLETED**
104106
- [ ] packages/packherd-require
105107
- [ ] packages/proxy
106108
- [x] packages/rewriter ✅ **COMPLETED**

packages/config/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@
4040
},
4141
"devDependencies": {
4242
"@packages/errors": "0.0.0-development",
43-
"@packages/network": "0.0.0-development",
43+
"@packages/network-tools": "0.0.0-development",
4444
"@packages/root": "0.0.0-development",
4545
"@packages/ts": "0.0.0-development",
4646
"@packages/types": "0.0.0-development",
4747
"babel-plugin-tester": "^10.1.0",
4848
"rimraf": "6.0.1",
49+
"typescript": "~5.4.5",
4950
"vitest": "^3.2.4"
5051
},
5152
"files": [

packages/config/src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import _ from 'lodash'
22
import { toBoolean } from 'underscore.string'
3-
import * as uri from '@packages/network/lib/uri'
3+
import { origin } from '@packages/network-tools'
44

55
export const hideKeys = (token?: string | number | boolean) => {
66
if (!token) {
@@ -26,7 +26,7 @@ export function setUrls (obj: any) {
2626
const proxyUrl = `http://localhost:${obj.port}`
2727

2828
const rootUrl = obj.baseUrl
29-
? uri.origin(obj.baseUrl)
29+
? origin(obj.baseUrl)
3030
: proxyUrl
3131

3232
return {

packages/driver/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"@packages/config": "0.0.0-development",
2727
"@packages/errors": "0.0.0-development",
2828
"@packages/net-stubbing": "0.0.0-development",
29-
"@packages/network": "0.0.0-development",
29+
"@packages/network-tools": "0.0.0-development",
3030
"@packages/proxy": "0.0.0-development",
3131
"@packages/rewriter": "0.0.0-development",
3232
"@packages/runner": "0.0.0-development",

packages/driver/src/cy/commands/origin/validator.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import $utils from '../../../cypress/utils'
22
import $errUtils from '../../../cypress/error_utils'
33
import { difference, isPlainObject, isString, isFunction } from 'lodash'
44
import type { LocationObject } from '../../../cypress/location'
5-
import * as cors from '@packages/network/lib/cors'
6-
import { DocumentDomainInjection } from '@packages/network/lib/document-domain-injection'
5+
import { policyFromConfig, DocumentDomainInjection } from '@packages/network-tools'
76

87
const validOptionKeys = Object.freeze(['args'])
98

@@ -87,7 +86,7 @@ export class Validator {
8786

8887
const injector = DocumentDomainInjection.InjectionBehavior(Cypress.config())
8988

90-
const policy = cors.policyFromConfig({ injectDocumentDomain: Cypress.config('injectDocumentDomain') })
89+
const policy = policyFromConfig({ injectDocumentDomain: Cypress.config('injectDocumentDomain') })
9190

9291
if (injector.urlsMatch(originLocation.href, specHref)) {
9392
$errUtils.throwErrByPath('origin.invalid_url_argument_same_origin', {

packages/driver/src/cypress.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import { PrimaryOriginCommunicator, SpecBridgeCommunicator } from './cross-origi
4545
import { setupAutEventHandlers } from './cypress/aut_event_handlers'
4646

4747
import type { CachedTestState, ReporterRunState, RunState } from '@packages/types'
48-
import { DocumentDomainInjection } from '@packages/network/lib/document-domain-injection'
48+
import { DocumentDomainInjection } from '@packages/network-tools'
4949
import { setSpecContentSecurityPolicy } from './util/privileged_channel'
5050

5151
import { telemetry } from '@packages/telemetry/browser/client'

0 commit comments

Comments
 (0)