Skip to content

Commit

Permalink
Merge pull request embroider-build#1996 from embroider-build/merge-st…
Browse files Browse the repository at this point in the history
…able

Merge stable into main
  • Loading branch information
mansona authored Jun 21, 2024
2 parents ee5e024 + 3a3a078 commit 3734d9f
Show file tree
Hide file tree
Showing 12 changed files with 2,740 additions and 3,432 deletions.
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ runs:
name: Install pnpm
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20
cache: pnpm
- run: pnpm install ${{ fromJSON('{"false":"--no-lockfile", "true":"--frozen-lockfile"}')[inputs.use_lockfile] }}
shell: bash
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ jobs:
- uses: ./.github/actions/setup
with:
use_lockfile: false
- name: Work around windows short path alias # https://github.com/actions/runner-images/issues/712
if: runner.os == 'Windows'
run: echo "TEMP=$env:USERPROFILE\AppData\Local\Temp" >> $env:GITHUB_ENV
- name: suite
run: ${{ matrix.command }}
working-directory: ${{ matrix.dir }}
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
auto-install-peers=false
use-node-version=16.20.0
use-node-version=20.14.0
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# Embroider Changelog

## Release (2024-06-20)

@embroider/compat 3.5.4 (patch)
@embroider/core 3.4.13 (patch)
@embroider/macros 1.16.4 (patch)

#### :bug: Bug Fix
* `@embroider/macros`
* [#1994](https://github.com/embroider-build/embroider/pull/1994) MacrosConfig should sync globalConfigs between copies ([@ef4](https://github.com/ef4))

#### :house: Internal
* [#1993](https://github.com/embroider-build/embroider/pull/1993) update node to latest LTS for CI ([@mansona](https://github.com/mansona))

#### Committers: 2
- Chris Manson ([@mansona](https://github.com/mansona))
- Edward Faulkner ([@ef4](https://github.com/ef4))

## Release (2024-06-13)

@embroider/compat 3.5.3 (patch)
@embroider/core 3.4.12 (patch)

#### :bug: Bug Fix
* `@embroider/compat`, `@embroider/core`, `@embroider/sample-transforms`
* [#1969](https://github.com/embroider-build/embroider/pull/1969) Update `fast-sourcemap-concat` to remove dependency `lodash.template` for consumer apps (security vulnerability) ([@mkszepp](https://github.com/mkszepp))

#### Committers: 1
- Markus Sanin ([@mkszepp](https://github.com/mkszepp))

## Release (2024-06-12)

@embroider/webpack 4.0.3 (patch)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"jest": "^29.2.1",
"prettier": "^2.3.1",
"release-plan": "^0.9.0",
"typescript": "^5.4.5"
"typescript": "^5.5.2"
},
"publishConfig": {
"registry": "https://registry.npmjs.org"
Expand Down
4 changes: 2 additions & 2 deletions packages/compat/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@embroider/compat",
"version": "3.5.2",
"version": "3.5.4",
"private": false,
"description": "Backward compatibility layer for the Embroider build system.",
"repository": {
Expand Down Expand Up @@ -50,7 +50,7 @@
"chalk": "^4.1.1",
"debug": "^4.3.2",
"escape-string-regexp": "^4.0.0",
"fast-sourcemap-concat": "^1.4.0",
"fast-sourcemap-concat": "^2.1.1",
"fs-extra": "^9.1.0",
"fs-tree-diff": "^2.0.1",
"jsdom": "^16.6.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@embroider/core",
"version": "3.4.11",
"version": "3.4.13",
"private": false,
"description": "A build system for EmberJS applications.",
"repository": {
Expand Down Expand Up @@ -34,7 +34,7 @@
"broccoli-source": "^3.0.1",
"debug": "^4.3.2",
"escape-string-regexp": "^4.0.0",
"fast-sourcemap-concat": "^1.4.0",
"fast-sourcemap-concat": "^2.1.1",
"filesize": "^10.0.7",
"fs-extra": "^9.1.0",
"fs-tree-diff": "^2.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/macros/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@embroider/macros",
"version": "1.16.3",
"version": "1.16.4",
"private": false,
"description": "Standardized build-time macros for ember apps.",
"keywords": [
Expand Down
43 changes: 26 additions & 17 deletions packages/macros/src/macros-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ export type Merger = (
}
) => object;

interface GlobalSharedEntry {
configs: Map<string, object[]>;
globalConfigs: Record<string, string>;
configSources: WeakMap<object, string>;
mergers: Map<string, { merger: Merger; fromPath: string }>;
}

// Do not change this type signature without pondering deeply the mysteries of
// being compatible with unwritten future versions of this library.
type GlobalSharedState = WeakMap<
any,
{
configs: Map<string, object[]>;
configSources: WeakMap<object, string>;
mergers: Map<string, { merger: Merger; fromPath: string }>;
}
>;
type GlobalSharedState = WeakMap<any, GlobalSharedEntry>;

// this is a module-scoped cache. If multiple callers ask _this copy_ of
// @embroider/macros for a shared MacrosConfig, they'll all get the same one.
Expand Down Expand Up @@ -93,25 +93,29 @@ export default class MacrosConfig {
if (!shared.configSources) {
shared.configSources = new WeakMap();
}

// earlier versions did not include this -- we may need to upgrade the
// format here
if (!shared.globalConfigs) {
shared.globalConfigs = {};
}
} else {
shared = {
configs: new Map(),
globalConfigs: {},
configSources: new WeakMap(),
mergers: new Map(),
};
g.__embroider_macros_global__.set(key, shared);
}

let config = new MacrosConfig(appRoot);
config.configs = shared.configs;
config.configSources = shared.configSources;
config.mergers = shared.mergers;
let config = new MacrosConfig(appRoot, shared);
localSharedState.set(key, config);
return config;
}

private mode: 'compile-time' | 'run-time' = 'compile-time';
private globalConfig: { [key: string]: unknown } = {};
private globalConfig: { [key: string]: unknown };

private isDevelopingPackageRoots: Set<string> = new Set();

Expand All @@ -135,7 +139,12 @@ export default class MacrosConfig {
}
}

private constructor(private origAppRoot: string) {
private constructor(private origAppRoot: string, shared: GlobalSharedEntry) {
this.configs = shared.configs;
this.globalConfig = shared.globalConfigs;
this.configSources = shared.configSources;
this.mergers = shared.mergers;

// this uses globalConfig because these things truly are global. Even if a
// package doesn't have a dep or peerDep on @embroider/macros, it's legit
// for them to want to know the answer to these questions, and there is only
Expand Down Expand Up @@ -164,9 +173,9 @@ export default class MacrosConfig {
}

private _configWritable = true;
private configs: Map<string, object[]> = new Map();
private configSources: WeakMap<object, string> = new WeakMap();
private mergers: Map<string, { merger: Merger; fromPath: string }> = new Map();
private configs: Map<string, object[]>;
private configSources: WeakMap<object, string>;
private mergers: Map<string, { merger: Merger; fromPath: string }>;

// Registers a new source of configuration to be given to the named package.
// Your config type must be json-serializable. You must always set fromPath to
Expand Down
7 changes: 4 additions & 3 deletions packages/shared-internals/src/rewritten-package-cache.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import PackageCache from './package-cache';
import type { V2AddonPackage, V2AppPackage, V2Package } from './package';
import Package from './package';
import { existsSync, readJSONSync, realpathSync } from 'fs-extra';
import { resolve } from 'path';
Expand Down Expand Up @@ -240,15 +241,15 @@ class WrappedPackage implements PackageTheGoodParts {
return this.plainPkg.isLazyEngine();
}

isV2Ember() {
isV2Ember(): this is V2Package {
return this.plainPkg.isV2Ember();
}

isV2App() {
isV2App(): this is V2AppPackage {
return this.plainPkg.isV2App();
}

isV2Addon() {
isV2Addon(): this is V2AddonPackage {
return this.plainPkg.isV2Addon();
}

Expand Down
Loading

0 comments on commit 3734d9f

Please sign in to comment.