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

Publish ember-source as v2 addon #20787

Merged
merged 2 commits into from
Nov 11, 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
32 changes: 27 additions & 5 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,27 @@ add(
path.join(__dirname, '..', 'dist', 'ember-template-compiler.js')
);

const { addonV1Shim } = require('@embroider/addon-shim');

const shim = addonV1Shim(path.join(__dirname, '..'), {
autoImportCompat: {
customizeMeta(meta) {
return { ...meta, 'renamed-modules': {} };
},
},
});

module.exports = {
...shim,
paths,
absolutePaths,

init() {
this._super.init && this._super.init.apply(this, arguments);
if (shim.init) {
shim.init.apply(this, arguments);
} else {
this._super.init && this._super.init.apply(this, arguments);
}

// resets `this.root` to the correct location by default ember-cli
// considers `__dirname` here to be the root, but since our main entry
Expand All @@ -43,16 +61,17 @@ module.exports = {
this.treePaths.vendor = 'dist';
},

name: 'ember-source',
paths,
absolutePaths,
_overrideTree: undefined,

// Expose supported list of browsers for reference by other packages
supportedBrowsers: SupportedBrowsers,

included() {
this._super.included.apply(this, arguments);
if (shim.included) {
shim.included.apply(this, arguments);
} else {
this._super.included.apply(this, arguments);
}

let overrides = Overrides.for(this.project);

Expand Down Expand Up @@ -104,6 +123,9 @@ module.exports = {
},

treeForVendor(tree) {
if (shim.treeForVendor) {
tree = shim.treeForVendor.call(this, tree);
}
const isProduction = process.env.EMBER_ENV === 'production';

let templateCompiler = new Funnel(tree, {
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"dependencies": {
"@babel/core": "^7.24.4",
"@ember/edition-utils": "^1.2.0",
"@embroider/addon-shim": "^1.9.0",
"@glimmer/compiler": "0.92.4",
"@glimmer/destroyable": "0.92.3",
"@glimmer/env": "^0.1.7",
Expand All @@ -88,7 +89,7 @@
"broccoli-funnel": "^3.0.8",
"broccoli-merge-trees": "^4.2.0",
"chalk": "^4.0.0",
"ember-auto-import": "^2.6.3",
"ember-auto-import": "^2.10.0",
"ember-cli-babel": "^8.2.0",
"ember-cli-get-component-path-option": "^1.0.0",
"ember-cli-is-package-missing": "^1.0.0",
Expand Down Expand Up @@ -181,6 +182,7 @@
"ember-addon": {
"after": "ember-cli-legacy-blueprints",
"type": "addon",
"version": 2,
"renamed-modules": {
"@ember/-internals/browser-environment/index.js": "ember-source/@ember/-internals/browser-environment/index.js",
"@ember/-internals/container/index.js": "ember-source/@ember/-internals/container/index.js",
Expand Down
Loading