Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build reform #20675

Merged
merged 3 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ module.exports = {
// matches all node-land files
files: [
'.eslintrc.js',
'rollup.config.mjs',
'babel.config.mjs',
'babel.test.config.mjs',
'node-tests/**/*.js',
'tests/node/**/*.js',
'blueprints/**/*.js',
Expand Down
21 changes: 9 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- name: build
run: pnpm ember build
run: pnpm vite build --mode=development
- name: Upload build
uses: actions/upload-artifact@v3
with:
Expand All @@ -99,30 +99,27 @@ jobs:
OVERRIDE_DEPRECATION_VERSION: "15.0.0"
ENABLE_OPTIONAL_FEATURES: "true"
- name: "Production build"
BUILD: "-prod"
BUILD: "production"
- name: "Production build, with optional features"
BUILD: "-prod"
BUILD: "production"
ENABLE_OPTIONAL_FEATURES: "true"
- name: "Extend prototypes"
EXTEND_PROTOTYPES: "true"
- name: "Extend prototypes, with optional features"
EXTEND_PROTOTYPES: "true"
ENABLE_OPTIONAL_FEATURES: "true"
- name: "Prebuilt"
PREBUILT: "true"

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- name: build
run: pnpm ember build ${{ matrix.BUILD }}
run: pnpm vite build --mode=${{ matrix.BUILD || 'development' }}
- name: test
env:
ALL_DEPRECATIONS_ENABLED: ${{ matrix.ALL_DEPRECATIONS_ENABLED }}
OVERRIDE_DEPRECATION_VERSION: ${{ matrix.OVERRIDE_DEPRECATION_VERSION }}
EXTEND_PROTOTYPES: ${{ matrix.EXTEND_PROTOTYPES }}
ENABLE_OPTIONAL_FEATURES: ${{ matrix.ENABLE_OPTIONAL_FEATURES }}
PREBUIlT: ${{ matrix.PREBUILT }}

run: pnpm test

Expand All @@ -135,8 +132,8 @@ jobs:
- uses: ./.github/actions/setup
- name: build
env:
SHOULD_TRANSPILE: true
run: pnpm ember build
ALL_SUPPORTED_BROWSERS: true
run: pnpm vite build --mode=development

- name: Set BrowserStack Local Identifier
if: startsWith(github.ref, 'refs/tags/v')
Expand All @@ -163,7 +160,7 @@ jobs:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- name: build
run: pnpm ember build -prod
run: pnpm build
- name: test
working-directory: smoke-tests/scenarios
run: |
Expand All @@ -179,7 +176,7 @@ jobs:
- name: build
env:
SHOULD_TRANSPILE_FOR_NODE: true
run: pnpm ember build -prod
run: pnpm build
- name: test
run: pnpm test:node

Expand Down Expand Up @@ -210,7 +207,7 @@ jobs:
firefox-version: 102.0.1
- run: firefox --version
- name: test
run: pnpm ember test -c testem.ci-browsers.js
run: pnpm ember test --path dist -c testem.ci-browsers.js

deploy-tag:
name: Deploy tags to npm
Expand Down
37 changes: 37 additions & 0 deletions babel.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
This babel config governs how Ember gets built for publication. Features that
remain un-transpiled until used by an app are not handled here.

See babel.test.config.mjs for the extension to this config that governs our
test suite.
*/

import { resolve, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';

export default {
plugins: [
[
'@babel/plugin-transform-typescript',
{
allowDeclareFields: true,
},
],
[
'module:decorator-transforms',
{
runEarly: true,
runtime: { import: 'decorator-transforms/runtime' },
},
],
[
'babel-plugin-ember-template-compilation',
{
compilerPath: resolve(
dirname(fileURLToPath(import.meta.url)),
'./broccoli/glimmer-template-compiler'
),
},
],
],
};
35 changes: 35 additions & 0 deletions babel.test.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
This babel config governs Ember's test suite. It transpiles some things that
our published build should not (because those things are left for apps to
decide).

See babel.config.mjs for the base config that's used for building for
publication.
*/

import { createRequire } from 'node:module';
import vmBabelPlugins from '@glimmer/vm-babel-plugins';
import baseConfig from './babel.config.mjs';

const require = createRequire(import.meta.url);
const buildDebugMacroPlugin = require('./broccoli/build-debug-macro-plugin.js');
const isProduction = process.env.EMBER_ENV === 'production';

export default {
...baseConfig,

presets: [
[
'@babel/preset-env',
{
targets: require('./config/targets.js'),
},
],
],

plugins: [
...baseConfig.plugins,
buildDebugMacroPlugin(!isProduction),
...vmBabelPlugins({ isDebug: !isProduction }),
],
};
8 changes: 1 addition & 7 deletions bin/run-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ const variants = [
// This enables all canary feature flags for unreleased feature within Ember
// itself.
'ENABLE_OPTIONAL_FEATURES',

// This forces the test suite to run against the prepackaged copy of
// ember.debug.js that publishes in the ember-source NPM package. That copy is
// essentially an optimization if you happen to be doing development under the
// default babel targets.
'PREBUILT',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This concept stops being useful in this PR. It was very specific to the old optimization where sometimes ember would use a prebuilt bundle and other times it wouldn't.

];

const chalk = require('chalk');
Expand Down Expand Up @@ -73,7 +67,7 @@ function run() {
}
}

let url = 'http://localhost:' + PORT + '/tests/?' + queryString;
let url = 'http://localhost:' + PORT + '/?' + queryString;
return runInBrowser(url, 3);
}

Expand Down
202 changes: 202 additions & 0 deletions broccoli/amd-compat-entrypoints/ember-template-compiler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
/* eslint-disable */

// This file was derived from the output of the classic broccoli-based build of
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intent for these three amd-compat-entrypoints files is that they're capturing a final snapshot of what we ship in the backward-compatible AMD bundles. We should consider them frozen going forward. New modules shouldn't go into them.

Instead, new modules should ship like normal addon modules from treeForAddon.

The rationale here is that moving existing modules out of vendor.js is a breaking change. But new modules that have never been in vendor.js can avoid ever going there.

This PR doesn't introduce any new modules doing things the new way, but I intend to do that in my next PR.

// ember-template-compiler.js. It's intended to convey exactly how the authored ES modules
// get mapped into backward-compatible AMD defines.

import d from 'amd-compat-entrypoint-definition';

import * as emberinternalsBrowserEnvironmentIndex from '@ember/-internals/browser-environment/index';
d('@ember/-internals/browser-environment/index', emberinternalsBrowserEnvironmentIndex);

import * as emberinternalsEnvironmentIndex from '@ember/-internals/environment/index';
d('@ember/-internals/environment/index', emberinternalsEnvironmentIndex);

import * as emberinternalsUtilsIndex from '@ember/-internals/utils/index';
d('@ember/-internals/utils/index', emberinternalsUtilsIndex);

import * as emberCanaryFeaturesIndex from '@ember/canary-features/index';
d('@ember/canary-features/index', emberCanaryFeaturesIndex);

/*

The classic build included these modules but not their dependencies, so they
never worked. Keeping this comment to document why the list of modules differs in
this way.

import * as emberDebugContainerDebugAdapter from '@ember/debug/container-debug-adapter';
d('@ember/debug/container-debug-adapter', emberDebugContainerDebugAdapter);

import * as emberDebugDataAdapter from '@ember/debug/data-adapter';
d('@ember/debug/data-adapter', emberDebugDataAdapter);

*/

import * as emberDebugIndex from '@ember/debug/index';
d('@ember/debug/index', emberDebugIndex);

import * as emberDebugLibCaptureRenderTree from '@ember/debug/lib/capture-render-tree';
d('@ember/debug/lib/capture-render-tree', emberDebugLibCaptureRenderTree);

import * as emberDebugLibDeprecate from '@ember/debug/lib/deprecate';
d('@ember/debug/lib/deprecate', emberDebugLibDeprecate);

import * as emberDebugLibHandlers from '@ember/debug/lib/handlers';
d('@ember/debug/lib/handlers', emberDebugLibHandlers);

import * as emberDebugLibInspect from '@ember/debug/lib/inspect';
d('@ember/debug/lib/inspect', emberDebugLibInspect);

import * as emberDebugLibTesting from '@ember/debug/lib/testing';
d('@ember/debug/lib/testing', emberDebugLibTesting);

import * as emberDebugLibWarn from '@ember/debug/lib/warn';
d('@ember/debug/lib/warn', emberDebugLibWarn);

import * as emberDeprecatedFeaturesIndex from '@ember/deprecated-features/index';
d('@ember/deprecated-features/index', emberDeprecatedFeaturesIndex);

import * as glimmerCompiler from '@glimmer/compiler';
d('@glimmer/compiler', glimmerCompiler);

import * as glimmerEnv from '@glimmer/env';
d('@glimmer/env', glimmerEnv);

import * as glimmerSyntax from '@glimmer/syntax';
d('@glimmer/syntax', glimmerSyntax);

import * as glimmerUtil from '@glimmer/util';
d('@glimmer/util', glimmerUtil);

import * as glimmerVm from '@glimmer/vm';
d('@glimmer/vm', glimmerVm);

import * as glimmerWireFormat from '@glimmer/wire-format';
d('@glimmer/wire-format', glimmerWireFormat);

import * as handlebarsParserIndex from '@handlebars/parser';
d('@handlebars/parser/index', handlebarsParserIndex);

import * as emberTemplateCompilerIndex from 'ember-template-compiler/index';
d('ember-template-compiler/index', emberTemplateCompilerIndex);

import * as emberTemplateCompilerLibPluginsAssertAgainstAttrs from 'ember-template-compiler/lib/plugins/assert-against-attrs';
d(
'ember-template-compiler/lib/plugins/assert-against-attrs',
emberTemplateCompilerLibPluginsAssertAgainstAttrs
);

import * as emberTemplateCompilerLibPluginsAssertAgainstNamedOutlets from 'ember-template-compiler/lib/plugins/assert-against-named-outlets';
d(
'ember-template-compiler/lib/plugins/assert-against-named-outlets',
emberTemplateCompilerLibPluginsAssertAgainstNamedOutlets
);

import * as emberTemplateCompilerLibPluginsAssertInputHelperWithoutBlock from 'ember-template-compiler/lib/plugins/assert-input-helper-without-block';
d(
'ember-template-compiler/lib/plugins/assert-input-helper-without-block',
emberTemplateCompilerLibPluginsAssertInputHelperWithoutBlock
);

import * as emberTemplateCompilerLibPluginsAssertReservedNamedArguments from 'ember-template-compiler/lib/plugins/assert-reserved-named-arguments';
d(
'ember-template-compiler/lib/plugins/assert-reserved-named-arguments',
emberTemplateCompilerLibPluginsAssertReservedNamedArguments
);

import * as emberTemplateCompilerLibPluginsIndex from 'ember-template-compiler/lib/plugins/index';
d('ember-template-compiler/lib/plugins/index', emberTemplateCompilerLibPluginsIndex);

import * as emberTemplateCompilerLibPluginsTransformActionSyntax from 'ember-template-compiler/lib/plugins/transform-action-syntax';
d(
'ember-template-compiler/lib/plugins/transform-action-syntax',
emberTemplateCompilerLibPluginsTransformActionSyntax
);

import * as emberTemplateCompilerLibPluginsTransformEachInIntoEach from 'ember-template-compiler/lib/plugins/transform-each-in-into-each';
d(
'ember-template-compiler/lib/plugins/transform-each-in-into-each',
emberTemplateCompilerLibPluginsTransformEachInIntoEach
);

import * as emberTemplateCompilerLibPluginsTransformEachTrackArray from 'ember-template-compiler/lib/plugins/transform-each-track-array';
d(
'ember-template-compiler/lib/plugins/transform-each-track-array',
emberTemplateCompilerLibPluginsTransformEachTrackArray
);

import * as emberTemplateCompilerLibPluginsTransformInElement from 'ember-template-compiler/lib/plugins/transform-in-element';
d(
'ember-template-compiler/lib/plugins/transform-in-element',
emberTemplateCompilerLibPluginsTransformInElement
);

import * as emberTemplateCompilerLibPluginsTransformQuotedBindingsIntoJustBindings from 'ember-template-compiler/lib/plugins/transform-quoted-bindings-into-just-bindings';
d(
'ember-template-compiler/lib/plugins/transform-quoted-bindings-into-just-bindings',
emberTemplateCompilerLibPluginsTransformQuotedBindingsIntoJustBindings
);

import * as emberTemplateCompilerLibPluginsTransformResolutions from 'ember-template-compiler/lib/plugins/transform-resolutions';
d(
'ember-template-compiler/lib/plugins/transform-resolutions',
emberTemplateCompilerLibPluginsTransformResolutions
);

import * as emberTemplateCompilerLibPluginsTransformWrapMountAndOutlet from 'ember-template-compiler/lib/plugins/transform-wrap-mount-and-outlet';
d(
'ember-template-compiler/lib/plugins/transform-wrap-mount-and-outlet',
emberTemplateCompilerLibPluginsTransformWrapMountAndOutlet
);

import * as emberTemplateCompilerLibPluginsUtils from 'ember-template-compiler/lib/plugins/utils';
d('ember-template-compiler/lib/plugins/utils', emberTemplateCompilerLibPluginsUtils);

import * as emberTemplateCompilerLibPublicApi from 'ember-template-compiler/lib/public-api';
d('ember-template-compiler/lib/public-api', emberTemplateCompilerLibPublicApi);

import * as emberTemplateCompilerLibSystemBootstrap from 'ember-template-compiler/lib/system/bootstrap';
d('ember-template-compiler/lib/system/bootstrap', emberTemplateCompilerLibSystemBootstrap);

import * as emberTemplateCompilerLibSystemCalculateLocationDisplay from 'ember-template-compiler/lib/system/calculate-location-display';
d(
'ember-template-compiler/lib/system/calculate-location-display',
emberTemplateCompilerLibSystemCalculateLocationDisplay
);

import * as emberTemplateCompilerLibSystemCompileOptions from 'ember-template-compiler/lib/system/compile-options';
d(
'ember-template-compiler/lib/system/compile-options',
emberTemplateCompilerLibSystemCompileOptions
);

import * as emberTemplateCompilerLibSystemCompile from 'ember-template-compiler/lib/system/compile';
d('ember-template-compiler/lib/system/compile', emberTemplateCompilerLibSystemCompile);

import * as emberTemplateCompilerLibSystemDasherizeComponentName from 'ember-template-compiler/lib/system/dasherize-component-name';
d(
'ember-template-compiler/lib/system/dasherize-component-name',
emberTemplateCompilerLibSystemDasherizeComponentName
);

import * as emberTemplateCompilerLibSystemInitializer from 'ember-template-compiler/lib/system/initializer';
d('ember-template-compiler/lib/system/initializer', emberTemplateCompilerLibSystemInitializer);

import * as emberTemplateCompilerLibSystemPrecompile from 'ember-template-compiler/lib/system/precompile';
d('ember-template-compiler/lib/system/precompile', emberTemplateCompilerLibSystemPrecompile);

import * as emberTemplateCompilerLibTypes from 'ember-template-compiler/lib/types';
d('ember-template-compiler/lib/types', emberTemplateCompilerLibTypes);

import * as emberTemplateCompilerMinimal from 'ember-template-compiler/minimal';
d('ember-template-compiler/minimal', emberTemplateCompilerMinimal);

import * as emberVersion from 'ember/version';
d('ember/version', emberVersion);

import * as simpleHtmlTokenizer from 'simple-html-tokenizer';
d('simple-html-tokenizer', simpleHtmlTokenizer);

if (typeof module === 'object' && module.exports) {
module.exports = emberTemplateCompilerIndex;
}
Loading
Loading