Skip to content

[experiment] remove former-core envs from the workspace#10513

Merged
davidfirst merged 31 commits into
remove-core-envs-from-manifestfrom
experiment/remove-envs-from-workspace
Jul 23, 2026
Merged

[experiment] remove former-core envs from the workspace#10513
davidfirst merged 31 commits into
remove-core-envs-from-manifestfrom
experiment/remove-envs-from-workspace

Conversation

@davidfirst

Copy link
Copy Markdown
Member

Experiment (do not merge) — stacked on #10465 (remove-core-envs-from-manifest).

Now that the former-core envs (node/react/aspect/env/mdx/readme) are regular external envs, this removes their source from the workspace and consumes them as the pinned published legacy versions instead.

  • bit remove of the 6 env components (workspace-only untrack; remote versions untouched).
  • Pin the 5 otherwise-uninstalled legacy env packages in the root dependency policy (@teambit/node, @teambit/aspect, @teambit/env, @teambit/mdx, @teambit/readme) — without this the default node env can't resolve and ~154 components fail to load.

Purpose: see whether CI stays green when the workspace builds against the pinned published envs rather than in-tree source. Locally, install + compile succeed (308 components).

davidfirst and others added 23 commits July 20, 2026 19:38
Updates `teambit.harmony/envs/core-aspect-env` to 1.0.2 (the fixed
release) for all components using it. Done via `bit env update`.

1.0.1 broke the preview build (`GeneratePreview`) because its
react/preview chain pulled `bit-react-transformer@1.0.48`, which pins
the ESM-compiled `bit-component-meta@0.0.44`; 1.0.2 resolves a
transformer that pins the CJS build, so `bit install` recompiles all
components cleanly.
## Problem
`bit ripple errors` (without `--log`) printed a useless tail instead of
the real build error:

```
  scope/some-component
      isUserError: true
    }
```

The real failure was only visible via `bit ripple errors --log`.

## Cause
`extractErrorsFromLog` scanned the container log for markers and
returned `messages.slice(idx)` — everything from the first match to the
end. Two compounding defects:

1. The case-sensitive `'Error:'` pattern matched the substring inside
`isUserError: true` — a serialized property at the very end of the
stringified error object. The real markers (lowercase `error:`,
`ErrorFromRemote:`) never matched.
2. That accidental match sat near the end, so `slice(idx)` returned only
the last couple of lines and discarded the real error printed above it.

## Fix
- Match markers case-insensitively.
- Use a word boundary on `error:` (`\berror:`) so it no longer matches
`isUserError:`.
- Add real markers (`responded with the following error`, `unable to
find object`).
- Select the **earliest** matching line instead of the first pattern in
a priority list, so a late incidental match can't truncate the error
above it.
…) from workspace

pin their published legacy versions in the root dependency policy so they
install as external envs. testing whether the workspace can build against
the pinned published envs instead of keeping their source in-tree.
…10511)

Picks up typescript-compiler v4.0.0: the config writer's
`compilerOptions` option is removed (it couldn't serialize TS's numeric
enums to a valid tsconfig.json), and generated `include`/`exclude` paths
are normalized to POSIX.

No call-site changes needed — this repo's envs (`react.env.ts`,
`aspect.env.ts`) pass only `tsconfig` to `TypescriptConfigWriter`. All
components compile clean with the new version.
Automated biweekly refresh of scripts/e2e-test-timings.json from the
last 12 e2e runs (111 entries drifted meaningfully). Generated by the
e2e_timings_refresh scheduled workflow.

Co-authored-by: CircleCI <ci@bit.dev>
Archive release notes for the recent small releases that were published
as GitHub releases but not yet committed to the repo.

- `v2.0.26.md` — the release just promoted to stable
- `v2.0.11.md` and `v2.0.2.md` — backfilled from their GitHub release
bodies

The `v2.0.26` GitHub release + tag are already published:
https://github.com/teambit/bit/releases/tag/v2.0.26
… declarations (#10514)

The root type-check (`tsc --noEmit`) resolves
`*.scss`/`*.css`/`*.mdx`/asset imports via ambient module declarations
that currently live only inside the react env source
(`scopes/react/react/typescript/{style,asset}.d.ts`). This adds an
equivalent workspace-level `typings/` dir so the root type-check no
longer depends on that env's source being present in the workspace.

Also adds `@ts-nocheck` to three node-env e2e fixtures (matching their
already-nocheck'd sibling) so they don't type-depend on the
`@teambit/node` source.

No runtime/behavior change. Verified locally that `tsc --noEmit` passes
both with and without the react env's `.d.ts` present.
… declarations (#10514)

The root type-check (`tsc --noEmit`) resolves
`*.scss`/`*.css`/`*.mdx`/asset imports via ambient module declarations
that currently live only inside the react env source
(`scopes/react/react/typescript/{style,asset}.d.ts`). This adds an
equivalent workspace-level `typings/` dir so the root type-check no
longer depends on that env's source being present in the workspace.

Also adds `@ts-nocheck` to three node-env e2e fixtures (matching their
already-nocheck'd sibling) so they don't type-depend on the
`@teambit/node` source.

No runtime/behavior change. Verified locally that `tsc --noEmit` passes
both with and without the react env's `.d.ts` present.
…m the versionless bit-root

install places a legacy core env's pinned external package in the VERSIONLESS
bit-root (.bit_roots/<id-with-underscores>) because calculateEnvId returns the
versionless id for these envs. getRuntimeModulePath, however, looked up the
VERSIONED bit-root when the env is not in the workspace, missed it, and fell back
to <root>/node_modules/<pkg> - the source-component dir that no longer exists once
the env source is removed - causing 'Cannot find module @teambit/node' for all
components on the default env. use the versionless self-root for legacy core envs
regardless of isInWorkspace, matching how install names it.
…act-env ts-nocheck

TEMP: log where getRuntimeModulePath looks for a legacy core env's package on CI
(versionless vs versioned bit-root, root node_modules, .bit_roots listing) to pin
down why @teambit/node isn't found once the env source is removed. to be reverted.

also @ts-nocheck custom-react-env fixture (published-vs-source react env type
mismatch), matching the node fixtures handled in #10514.
…0515)

Removes the source-level references to the former-core env packages that
sit **outside the core manifest**, so those envs aren't pulled into the
bit binary's dependency closure once they become external. Part of the
effort to ship the binary without the former-core envs.

- `ui.main.runtime.ts`: drop the dead `import type { AspectMain }` from
`@teambit/aspect` — `UIDeps` declared an 8th tuple slot the provider
never destructures (`static dependencies` and the provider only use 7).
- `apply-providers.tsx`: reference the react env aspect id as a string
literal instead of importing `@teambit/react` solely for
`ReactAspect.id`.

Deliberately left: `load-aspect.ts` still loads `NodeAspect` (test-only
helper, not in the binary, needs the default env), and the manifest's
own imports are handled by the core-env removal PR.

No runtime/behavior change; `tsc --noEmit` + oxlint pass.
…ad) — TEMP

pin whether node-babel-mocha (and siblings) fall out at require, batch-load, or
seeder-filter when @teambit/node is uninstalled after removing env source.
[DIAG-LOAD] lines to be reverted.
… or dep-aspect failures

Two load-side fixes for envs whose install layout is imperfect (e.g. the
versioned env root misses the env package):
1. a dependency aspect failing to resolve no longer aborts the whole
   resolveAspects call - only requested aspects still throw.
2. when several versions of an env fall back to the same package dir,
   keep the def matching the requested id instead of the first one.
…th module-not-found in env suppression

- add @bit-no-check to the 4 e2e fixture extensions importing the node env
  package, aligning them with the sibling fixtures (the package is not
  installed at the workspace root once the env source is removed).
- the legacy-core-env workspace-issue suppression only matched errors quoting
  the package name; also match the absolute-path form emitted when a resolved
  path is required.
…undle

require() of the ESM-only mdx options package may be hijacked by a stale
@babel/register pirates hook (left after the mocha tester runs in-process),
which compiles the ESM source as CJS and crashes on the export token.
load it with a native import() and pass it to createRspackConfig.
…dx aspect is not loaded

the mdx aspect used to be a core aspect, so its import detector for md/mdx
files was always registered. now that it's a regular env, docs imports (e.g.
a component's .docs.mdx importing another component) silently dropped from
the model when no workspace component loads the mdx aspect, breaking preview
bundling in capsules. register a regex-based fallback detector in
dependency-resolver; the mdx aspect's compile-based detector takes
precedence whenever it is loaded.
@davidfirst
davidfirst force-pushed the experiment/remove-envs-from-workspace branch from 21dc2f1 to d10ffc7 Compare July 22, 2026 16:49
…in md/mdx import detection

imports shown inside fenced code blocks are documentation examples, not real
ESM imports - detecting them produced self-import and missing-package issues
for docs that demonstrate usage. also anchor imports to line starts, as MDX
only treats block-level statements as ESM.
…e .js loader

a tester running in-process (e.g. mocha) may leave a @babel/register pirates
hook that replaces the .js extension loader and compiles ESM sources as CJS
scripts, crashing on the export token (seen when the published react env
lazily requires the ESM-only mdx options package during GeneratePreview).
capture the pristine loader at bootstrap and retry a failed ESM require with
it - node >= 22.12 handles require() of ESM natively.
…nvs-from-workspace

# Conflicts:
#	.bitmap
#	components/legacy/e2e-helper/excluded-fixtures/extensions/dev-files-env/dev-files-env.extension.ts
#	components/legacy/e2e-helper/excluded-fixtures/extensions/env-add-dependencies/add-deps-env.extension.ts
#	components/legacy/e2e-helper/excluded-fixtures/extensions/node-env-dev-dep/node-env.extension.ts
#	pnpm-lock.yaml
#	scopes/react/ui/docs/apply-providers/apply-providers.tsx
#	scripts/e2e-test-timings.json
@davidfirst
davidfirst merged commit b501f6f into remove-core-envs-from-manifest Jul 23, 2026
13 checks passed
@davidfirst
davidfirst deleted the experiment/remove-envs-from-workspace branch July 23, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants