Skip to content

Commit

Permalink
Merge pull request #2101 from embroider-build/merge-stable
Browse files Browse the repository at this point in the history
Merge stable
  • Loading branch information
ef4 authored Sep 9, 2024
2 parents 52687d4 + caef0c4 commit a691d39
Show file tree
Hide file tree
Showing 15 changed files with 280 additions and 144 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,5 @@ tests/scenarios/output/
# Sys files
.DS_Store
*.swp

/tsconfig.tsbuildinfo
60 changes: 60 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,65 @@
# Embroider Changelog

## Release (2024-08-30)

@embroider/compat 3.6.1 (patch)
@embroider/core 3.4.15 (patch)
@embroider/macros 1.16.6 (patch)
@embroider/shared-internals 2.6.3 (patch)
@embroider/webpack 4.0.5 (patch)

#### :bug: Bug Fix
* `@embroider/shared-internals`
* [#2075](https://github.com/embroider-build/embroider/pull/2075) Update ember standard modules to include @ember/renderer and @ember/-internals and ember-testing ([@NullVoxPopuli](https://github.com/NullVoxPopuli))
* `@embroider/compat`
* [#2067](https://github.com/embroider-build/embroider/pull/2067) codemod fixes ([@void-mAlex](https://github.com/void-mAlex))

#### :memo: Documentation
* [#2055](https://github.com/embroider-build/embroider/pull/2055) document templateTagCodemod usage ([@void-mAlex](https://github.com/void-mAlex))

#### :house: Internal
* `@embroider/webpack`
* [#2076](https://github.com/embroider-build/embroider/pull/2076) [Stable]: Follow upstream type change from webpack ([@NullVoxPopuli](https://github.com/NullVoxPopuli))
* Other
* [#2058](https://github.com/embroider-build/embroider/pull/2058) Set the packageManager field ([@NullVoxPopuli](https://github.com/NullVoxPopuli))

#### Committers: 2
- Alex ([@void-mAlex](https://github.com/void-mAlex))
- [@NullVoxPopuli](https://github.com/NullVoxPopuli)

## Release (2024-07-18)

@embroider/compat 3.6.0 (minor)

#### :rocket: Enhancement
* `@embroider/compat`, `@embroider/test-scenarios`
* [#1842](https://github.com/embroider-build/embroider/pull/1842) [beta] template-tag code mod ([@void-mAlex](https://github.com/void-mAlex))

#### Committers: 1
- Alex ([@void-mAlex](https://github.com/void-mAlex))

## Release (2024-07-16)

@embroider/compat 3.5.7 (patch)
@embroider/util 1.13.2 (patch)

#### :bug: Bug Fix
* `@embroider/compat`
* [#2033](https://github.com/embroider-build/embroider/pull/2033) Remove deprecations warnings in resolver transform ([@mkszepp](https://github.com/mkszepp))
* [#2047](https://github.com/embroider-build/embroider/pull/2047) Add semver to power select with create ([@mkszepp](https://github.com/mkszepp))

#### :house: Internal
* `@embroider/test-scenarios`
* [#1930](https://github.com/embroider-build/embroider/pull/1930) create a smoke test for the widest possible matrix ([@mansona](https://github.com/mansona))
* Other
* [#2015](https://github.com/embroider-build/embroider/pull/2015) update github actions ([@mansona](https://github.com/mansona))
* `@embroider/util`, `@embroider/sample-transforms`, `@embroider/test-support`, `@embroider/test-scenarios`
* [#1931](https://github.com/embroider-build/embroider/pull/1931) update scenario-tester ([@mansona](https://github.com/mansona))

#### Committers: 2
- Chris Manson ([@mansona](https://github.com/mansona))
- Markus Sanin ([@mkszepp](https://github.com/mkszepp))

## Release (2024-07-03)

@embroider/compat 3.5.6 (patch)
Expand Down
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,28 @@ return require('@embroider/compat').compatBuild(app, Webpack, {
});
```

## Template Tag Codemod

Edit `ember-cli-build.js`:
```js
return require('@embroider/compat').templateTagCodemod(app, {
shouldTransformPath: (path) => { return true; },
dryRun: true,
});
```
Run a normal ember build to transform your hbs templates into template tag single file components.
Requires optimized build (static* flags to be turned on)

### Options

* `shouldTransformPath` - allows users to filter the templates that the code mod would run on
* `dryRun` - option can be used to obtain a summary of the changed the build would perform and which files it would act upon

### Limitations

* App templates only
* `@embroider/compat` >= 3.6.0

## Compatibility

### Ember version
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"publishConfig": {
"registry": "https://registry.npmjs.org"
},
"packageManager": "[email protected]+sha256.691fe176eea9a8a80df20e4976f3dfb44a04841ceb885638fe2a26174f81e65e",
"changelog": {
"__comment__": "Our release infrastructure relies on these exact labels. Be careful changing them.",
"labels": {
Expand Down
3 changes: 2 additions & 1 deletion packages/compat/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@embroider/compat",
"version": "3.5.6",
"version": "3.6.1",
"private": false,
"description": "Backward compatibility layer for the Embroider build system.",
"repository": {
Expand All @@ -25,6 +25,7 @@
"dependencies": {
"@babel/code-frame": "^7.14.5",
"@babel/core": "^7.14.5",
"@babel/plugin-syntax-decorators": "^7.24.7",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.14.5",
"@babel/preset-env": "^7.14.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { PackageRules } from '..';
const rules: PackageRules[] = [
{
package: 'ember-power-select-with-create',
semverRange: '<3.0.0',
components: {
'<PowerSelectWithCreate/>': {
acceptsComponentArguments: ['powerSelectComponentName', 'suggestedOptionComponent'],
Expand Down
56 changes: 44 additions & 12 deletions packages/compat/src/resolver-transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -781,14 +781,14 @@ class TemplateResolver implements ASTPlugin {
if (node.path.type !== 'PathExpression') {
return;
}
let rootName = node.path.parts[0];
let rootName = headOf(node.path);
if (this.scopeStack.inScope(rootName, path)) {
return;
}
if (node.path.this === true) {
if (isThisHead(node.path)) {
return;
}
if (node.path.parts.length > 1) {
if (parts(node.path).length > 1) {
// paths with a dot in them (which therefore split into more than
// one "part") are classically understood by ember to be contextual
// components, which means there's nothing to resolve at this
Expand Down Expand Up @@ -820,10 +820,10 @@ class TemplateResolver implements ASTPlugin {
if (node.path.type !== 'PathExpression') {
return;
}
if (node.path.this === true) {
if (isThisHead(node.path)) {
return;
}
if (this.scopeStack.inScope(node.path.parts[0], path)) {
if (this.scopeStack.inScope(headOf(node.path), path)) {
return;
}
if (node.path.original === 'component' && node.params.length > 0) {
Expand Down Expand Up @@ -859,14 +859,14 @@ class TemplateResolver implements ASTPlugin {
if (node.path.type !== 'PathExpression') {
return;
}
let rootName = node.path.parts[0];
let rootName = headOf(node.path);
if (this.scopeStack.inScope(rootName, path)) {
return;
}
if (node.path.this === true) {
if (isThisHead(node.path)) {
return;
}
if (node.path.parts.length > 1) {
if (parts(node.path).length > 1) {
// paths with a dot in them (which therefore split into more than
// one "part") are classically understood by ember to be contextual
// components, which means there's nothing to resolve at this
Expand Down Expand Up @@ -921,16 +921,16 @@ class TemplateResolver implements ASTPlugin {
if (node.path.type !== 'PathExpression') {
return;
}
if (this.scopeStack.inScope(node.path.parts[0], path)) {
if (this.scopeStack.inScope(headOf(node.path), path)) {
return;
}
if (node.path.this === true) {
if (isThisHead(node.path)) {
return;
}
if (node.path.data === true) {
if (isAtHead(node.path)) {
return;
}
if (node.path.parts.length > 1) {
if (parts(node.path).length > 1) {
// paths with a dot in them (which therefore split into more than
// one "part") are classically understood by ember to be contextual
// components. With the introduction of `Template strict mode` in Ember 3.25
Expand Down Expand Up @@ -1161,3 +1161,35 @@ function appendArrays(objValue: any, srcValue: any) {
return objValue.concat(srcValue);
}
}

function headOf(path: any) {
if (!path) return;

return 'head' in path ? path.head.name : path.parts[0];
}

function isThisHead(path: any) {
if (!path) return;

if ('head' in path) {
return path.head.type === 'ThisHead';
}

return path.this === true;
}

function isAtHead(path: any) {
if (!path) return;

if ('head' in path) {
return path.head.type === 'AtHead';
}

return path.data === true;
}

function parts(path: any) {
if (!path) return;

return 'original' in path ? path.original.split('.') : path.parts;
}
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@embroider/core",
"version": "3.4.14",
"version": "3.4.15",
"private": false,
"description": "A build system for EmberJS applications.",
"repository": {
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/virtual-route-entrypoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import { getAppFiles, getFastbootFiles, importPaths, splitRoute, staticAppPathsP
const entrypointPattern = /(?<filename>.*)[\\/]-embroider-route-entrypoint.js:route=(?<route>.*)/;

export function encodeRouteEntrypoint(packagePath: string, matched: string | undefined, routeName: string): string {
return resolve(packagePath, `${matched}:route=${routeName}` ?? `-embroider-route-entrypoint.js:route=${routeName}`);
return resolve(
packagePath,
matched ? `${matched}:route=${routeName}` : `-embroider-route-entrypoint.js:route=${routeName}`
);
}

export function decodeRouteEntrypoint(filename: string): { fromDir: string; route: string } | undefined {
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.5",
"version": "1.16.6",
"private": false,
"description": "Standardized build-time macros for ember apps.",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion packages/shared-internals/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@embroider/shared-internals",
"version": "2.6.2",
"version": "2.6.3",
"private": false,
"description": "Utilities shared among the other embroider packages",
"repository": {
Expand Down
8 changes: 8 additions & 0 deletions packages/shared-internals/src/ember-standard-modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ emberVirtualPeerDeps.add('@ember/string');
// (like snowpack) not to worry about these packages.
emberVirtualPackages.add('@glimmer/env');
emberVirtualPackages.add('ember');
emberVirtualPackages.add('ember-testing');

// this is a real package and even though most of its primary API is implemented
// as transforms, it does include some runtime code.
Expand All @@ -45,6 +46,13 @@ emberVirtualPeerDeps.add('ember-source');
// the modules-api-polyfill. Newer APIs need to be added here.
emberVirtualPackages.add('@ember/owner');

// Added in ember-source 4.5.0-beta.1
emberVirtualPackages.add('@ember/renderer');

// Not provided by rfc176-data, but is needed for special librarys
// that know the dangers of importing private APIs
emberVirtualPackages.add('@ember/-internals');

// these are not public API but they're included in ember-source, so for
// correctness we still want to understand that they come from there.
emberVirtualPackages.add('@glimmer/validator');
Expand Down
2 changes: 1 addition & 1 deletion packages/util/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@embroider/util",
"version": "1.13.1",
"version": "1.13.2",
"description": "Utilities for app and addon authors.",
"keywords": [
"ember-addon"
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@embroider/webpack",
"version": "4.0.4",
"version": "4.0.5",
"private": false,
"description": "Builds EmberJS apps with Webpack",
"repository": {
Expand Down
Loading

0 comments on commit a691d39

Please sign in to comment.