Skip to content

Commit

Permalink
Merge pull request #934 from embroider-build/compiled-styles-issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue authored Aug 27, 2021
2 parents 2c6eda3 + a04ee3f commit 7a825df
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 126 deletions.
15 changes: 15 additions & 0 deletions packages/compat/src/v1-addon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,21 @@ export default class V1Addon {
private buildAddonStyles(built: IntermediateBuild) {
let addonStylesTree = this.addonStylesTree();
if (addonStylesTree) {
if (this.app.hasCompiledStyles) {
// >= ember-cli@3.18 store css files in <addon-name/__COMPILED_STYLES__
// and for embroider to work correctly need to be moved back to `/`
//
// speaking with @rwjblue the ember-cli build is now frozen, and it is
// ok to assume that after the above version no changes will occur
// makings this work-around safe.
//
// additional context: https://github.com/embroider-build/embroider/pull/934/files#r695269976
addonStylesTree = buildFunnel(addonStylesTree, {
srcDir: `${this.name}/__COMPILED_STYLES__`,
destDir: '/',
});
}

let discoveredFiles: string[] = [];
let tree = new ObserveTree(addonStylesTree, outputPath => {
discoveredFiles = walkSync(outputPath, { globs: ['**/*.css'], directories: false });
Expand Down
7 changes: 7 additions & 0 deletions packages/compat/src/v1-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import mapKeys from 'lodash/mapKeys';
import SynthesizeTemplateOnlyComponents from './synthesize-template-only-components';
import { isEmberAutoImportDynamic } from './detect-babel-plugins';
import prepHtmlbarsAstPluginsForUnwrap from './prepare-htmlbars-ast-plugins';
import { readFileSync } from 'fs';
import semver from 'semver';

// This controls and types the interface between our new world and the classic
// v1 app instance.
Expand Down Expand Up @@ -97,6 +99,11 @@ export default class V1App {
return dirname(emberCLIPackage);
}

@Memoize()
get hasCompiledStyles() {
return semver.gte(JSON.parse(readFileSync(`${this.emberCLILocation}/package.json`, 'utf8')).version, '3.18.0');
}

private requireFromEmberCLI(specifier: string) {
// eslint-disable-next-line @typescript-eslint/no-require-imports
return require(resolve.sync(specifier, { basedir: this.emberCLILocation }));
Expand Down
2 changes: 1 addition & 1 deletion test-packages/sample-transforms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@embroider/test-support": "0.36.0",
"broccoli-asset-rev": "^3.0.0",
"ember-auto-import": "^1.11.2",
"ember-cli": "~3.17.0",
"ember-cli": "~3.27.0",
"ember-cli-dependency-checker": "^3.1.0",
"ember-cli-eslint": "^5.1.0",
"ember-cli-htmlbars": "^4.3.1",
Expand Down
2 changes: 1 addition & 1 deletion test-packages/support/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"broccoli": "^3.4.2",
"console-ui": "^3.0.0",
"ember-auto-import": "^1.2.21",
"ember-cli": "~3.17.0",
"ember-cli": "~3.27.0",
"ember-cli-babel": "^7.20.5",
"ember-cli-htmlbars": "^4.2.0",
"ember-resolver": "^7.0.0",
Expand Down
2 changes: 1 addition & 1 deletion tests/app-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"babel-eslint": "^10.1.0",
"broccoli-asset-rev": "^3.0.0",
"ember-auto-import": "^1.11.2",
"ember-cli": "~3.26.0",
"ember-cli": "~3.27.0",
"ember-cli-app-version": "^5.0.0",
"ember-cli-babel": "^7.26.3",
"ember-cli-dependency-checker": "^3.2.0",
Expand Down
129 changes: 6 additions & 123 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.14.5.tgz#8ef4c18e58e801c5c95d3c1c0f2874a2680fadea"
integrity sha512-kixrYn4JwfAVPa0f2yfzc2AWti6WRRyO3XjWW5PJAvtE11qhSayrrcrEnee05KAtNaPC+EwehE8Qt1UedEVB8w==

"@babel/core@^7.0.0", "@babel/core@^7.1.0", "@babel/core@^7.1.6", "@babel/core@^7.10.2", "@babel/core@^7.12.0", "@babel/core@^7.12.10", "@babel/core@^7.12.3", "@babel/core@^7.12.9", "@babel/core@^7.13.8", "@babel/core@^7.14.5", "@babel/core@^7.3.4", "@babel/core@^7.7.7", "@babel/core@^7.8.4", "@babel/core@^7.8.7":
"@babel/core@^7.0.0", "@babel/core@^7.1.0", "@babel/core@^7.1.6", "@babel/core@^7.10.2", "@babel/core@^7.12.0", "@babel/core@^7.12.10", "@babel/core@^7.12.3", "@babel/core@^7.12.9", "@babel/core@^7.13.8", "@babel/core@^7.14.5", "@babel/core@^7.3.4", "@babel/core@^7.7.7", "@babel/core@^7.8.7":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.14.5.tgz#d281f46a9905f07d1b3bf71ead54d9c7d89cb1e3"
integrity sha512-RN/AwP2DJmQTZSfiDaD+JQQ/J99KsIpOCfBE5pL+5jJSt7nI3nYGoAXZu+ffYSQ029NLs2DstZb+eR81uuARgg==
Expand Down Expand Up @@ -4791,7 +4791,7 @@ broccoli-babel-transpiler@^6.5.0:
rsvp "^4.8.2"
workerpool "^2.3.0"

broccoli-babel-transpiler@^7.2.0, broccoli-babel-transpiler@^7.3.0, broccoli-babel-transpiler@^7.4.0, broccoli-babel-transpiler@^7.6.0, broccoli-babel-transpiler@^7.8.0:
broccoli-babel-transpiler@^7.2.0, broccoli-babel-transpiler@^7.3.0, broccoli-babel-transpiler@^7.6.0, broccoli-babel-transpiler@^7.8.0:
version "7.8.0"
resolved "https://registry.yarnpkg.com/broccoli-babel-transpiler/-/broccoli-babel-transpiler-7.8.0.tgz#7e0f01fce5739f49bbadeee7f1e625ca51cad66e"
integrity sha512-dv30Td5uL7dO3NzQUqQKQs+Iq7JGKnCNtvc6GBO76uVPqGnRlsQZcYqdBVr33JrctR+ZrpTUf7TjsFKeDRFA8Q==
Expand Down Expand Up @@ -7828,8 +7828,7 @@ ember-cli-is-package-missing@^1.0.0:
resolved "https://registry.yarnpkg.com/ember-cli-is-package-missing/-/ember-cli-is-package-missing-1.0.0.tgz#6e6184cafb92635dd93ca6c946b104292d4e3390"
integrity sha1-bmGEyvuSY13ZPKbJRrEEKS1OM5A=

"ember-cli-latest@npm:ember-cli@latest", ember-cli@~3.26.0:
name ember-cli-latest
"ember-cli-latest@npm:ember-cli@latest":
version "3.26.1"
resolved "https://registry.yarnpkg.com/ember-cli/-/ember-cli-3.26.1.tgz#43e924454f1fcff6157863925d0eb33bfa593c24"
integrity sha512-jJ0kMob21A/HIqkDNWQMZnnpadjS/xaBlv1RU1NoCUi+3Lqpt9esDT9cK0QCFp9vh4zfU4BEBNYkMN/SiQMaGg==
Expand Down Expand Up @@ -8119,100 +8118,6 @@ ember-cli-version-checker@^5.1.1, ember-cli-version-checker@^5.1.2:
semver "^7.3.4"
silent-error "^1.1.1"

ember-cli@~3.17.0:
version "3.17.0"
resolved "https://registry.yarnpkg.com/ember-cli/-/ember-cli-3.17.0.tgz#d846027c01f1835c7903b6bff073c2a80885202e"
integrity sha512-0GVer7AyV/g8hclbD64FmsNkULQ0N1pEQytB+utuJl8c6NFU4EUMJL7NyM/NRd7rzupMMR1jwzhxYTCY50ZRcg==
dependencies:
"@babel/core" "^7.8.4"
"@babel/plugin-transform-modules-amd" "^7.7.5"
amd-name-resolver "^1.3.1"
babel-plugin-module-resolver "^4.0.0"
bower-config "^1.4.1"
bower-endpoint-parser "0.2.2"
broccoli "^3.3.3"
broccoli-amd-funnel "^2.0.1"
broccoli-babel-transpiler "^7.4.0"
broccoli-builder "^0.18.14"
broccoli-concat "^3.7.4"
broccoli-config-loader "^1.0.1"
broccoli-config-replace "^1.1.2"
broccoli-debug "^0.6.5"
broccoli-funnel "^2.0.2"
broccoli-funnel-reducer "^1.0.0"
broccoli-merge-trees "^3.0.2"
broccoli-middleware "^2.1.1"
broccoli-slow-trees "^3.0.1"
broccoli-source "^3.0.0"
broccoli-stew "^3.0.0"
calculate-cache-key-for-tree "^2.0.0"
capture-exit "^2.0.0"
chalk "^3.0.0"
ci-info "^2.0.0"
clean-base-url "^1.0.0"
compression "^1.7.4"
configstore "^5.0.1"
console-ui "^3.1.1"
core-object "^3.1.5"
dag-map "^2.0.2"
diff "^4.0.1"
ember-cli-is-package-missing "^1.0.0"
ember-cli-lodash-subset "^2.0.1"
ember-cli-normalize-entity-name "^1.0.0"
ember-cli-preprocess-registry "^3.3.0"
ember-cli-string-utils "^1.1.0"
ember-source-channel-url "^2.0.1"
ensure-posix-path "^1.0.2"
execa "^1.0.0"
exit "^0.1.2"
express "^4.16.4"
filesize "^4.2.0"
find-up "^4.1.0"
find-yarn-workspace-root "^1.2.1"
fs-extra "^8.1.0"
fs-tree-diff "^2.0.1"
get-caller-file "^2.0.5"
git-repo-info "^2.1.1"
glob "^7.1.4"
heimdalljs "^0.2.6"
heimdalljs-fs-monitor "^0.2.3"
heimdalljs-graph "^1.0.0"
heimdalljs-logger "^0.1.10"
http-proxy "^1.18.0"
inflection "^1.12.0"
is-git-url "^1.0.0"
isbinaryfile "^3.0.3"
js-yaml "^3.13.1"
json-stable-stringify "^1.0.1"
leek "0.0.24"
lodash.template "^4.5.0"
markdown-it "^10.0.0"
markdown-it-terminal "0.1.1"
minimatch "^3.0.4"
morgan "^1.9.1"
nopt "^3.0.6"
npm-package-arg "^8.0.0"
p-defer "^3.0.0"
portfinder "^1.0.25"
promise-map-series "^0.3.0"
promise.hash.helper "^1.0.2"
quick-temp "^0.1.8"
resolve "^1.15.1"
resolve-package-path "^2.0.0"
sane "^4.1.0"
semver "^6.3.0"
silent-error "^1.1.1"
sort-package-json "^1.39.1"
symlink-or-copy "^1.3.1"
temp "0.9.1"
testem "^3.0.1"
tiny-lr "^1.1.1"
tree-sync "^2.0.0"
uuid "^3.4.0"
walk-sync "^2.0.2"
watch-detector "^1.0.0"
yam "^1.0.0"

ember-cli@~3.27.0:
version "3.27.0"
resolved "https://registry.yarnpkg.com/ember-cli/-/ember-cli-3.27.0.tgz#8ccf9db51d7b462f86210b853d086a4543605c34"
Expand Down Expand Up @@ -13394,17 +13299,6 @@ markdown-it-terminal@0.1.0:
lodash.merge "^4.6.0"
markdown-it "^8.3.1"

markdown-it-terminal@0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/markdown-it-terminal/-/markdown-it-terminal-0.1.1.tgz#7665d28a97f6f7f61f8738304d409a8505620192"
integrity sha512-8v4pHGEh7eiw+UbD28PRyrpu+WrnRR/HefC6NRs+Ttbk1ZQoOY6ViMrkZcdO9Y+PoBsfxNsmiJZtG9BRHEGZ2A==
dependencies:
ansi-styles "^3.0.0"
cardinal "^1.0.0"
cli-table "^0.3.1"
lodash.merge "^4.6.2"
markdown-it "^8.3.1"

markdown-it-terminal@0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/markdown-it-terminal/-/markdown-it-terminal-0.2.1.tgz#670fd5ea824a7dcaa1591dcbeef28bf70aff1705"
Expand All @@ -13416,17 +13310,6 @@ markdown-it-terminal@0.2.1:
lodash.merge "^4.6.2"
markdown-it "^8.3.1"

markdown-it@^10.0.0:
version "10.0.0"
resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-10.0.0.tgz#abfc64f141b1722d663402044e43927f1f50a8dc"
integrity sha512-YWOP1j7UbDNz+TumYP1kpwnP0aEa711cJjrAQrzd0UXlbJfc5aAq0F/PZHjiioqDC1NKgvIMX+o+9Bk7yuM2dg==
dependencies:
argparse "^1.0.7"
entities "~2.0.0"
linkify-it "^2.0.0"
mdurl "^1.0.1"
uc.micro "^1.0.5"

markdown-it@^11.0.0:
version "11.0.1"
resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-11.0.1.tgz#b54f15ec2a2193efa66dda1eb4173baea08993d6"
Expand Down Expand Up @@ -14138,7 +14021,7 @@ npm-package-arg@^6.1.1:
semver "^5.6.0"
validate-npm-package-name "^3.0.0"

npm-package-arg@^8.0.0, npm-package-arg@^8.0.1, npm-package-arg@^8.1.0, npm-package-arg@^8.1.1:
npm-package-arg@^8.0.1, npm-package-arg@^8.1.0, npm-package-arg@^8.1.1:
version "8.1.4"
resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-8.1.4.tgz#8001cdbc4363997b8ef6c6cf7aaf543c5805879d"
integrity sha512-xLokoCFqj/rPdr3LvcdDL6Kj6ipXGEDHD/QGpzwU6/pibYUOXmp5DBmg76yukFyx4ZDbrXNOTn+BPyd8TD4Jlw==
Expand Down Expand Up @@ -15034,7 +14917,7 @@ promise-retry@^1.1.1:
err-code "^1.0.0"
retry "^0.10.0"

promise.hash.helper@^1.0.2, promise.hash.helper@^1.0.6, promise.hash.helper@^1.0.7:
promise.hash.helper@^1.0.6, promise.hash.helper@^1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/promise.hash.helper/-/promise.hash.helper-1.0.7.tgz#2f39d8495df40dcdfbc1d5be9e9e56efeae7f180"
integrity sha512-0qhWYyCV9TYDMSooYw1fShIb7R6hsWYja7JLqbeb1MvHqDTvP/uy/R1RsyVqDi6GCiHOI4G5p2Hpr3IA+/l/+Q==
Expand Down Expand Up @@ -15797,7 +15680,7 @@ resolve@1.1.7:
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"
integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=

resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.11.1, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.14.0, resolve@^1.14.2, resolve@^1.15.0, resolve@^1.15.1, resolve@^1.17.0, resolve@^1.18.1, resolve@^1.19.0, resolve@^1.20.0, resolve@^1.3.3, resolve@^1.4.0, resolve@^1.5.0, resolve@^1.8.1:
resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.11.1, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.14.0, resolve@^1.14.2, resolve@^1.15.0, resolve@^1.17.0, resolve@^1.18.1, resolve@^1.19.0, resolve@^1.20.0, resolve@^1.3.3, resolve@^1.4.0, resolve@^1.5.0, resolve@^1.8.1:
version "1.20.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975"
integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==
Expand Down

0 comments on commit 7a825df

Please sign in to comment.