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

Update to [email protected] #766

Merged
merged 4 commits into from
May 19, 2021
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
6 changes: 3 additions & 3 deletions packages/addon-shim/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
AddonInstance,
isDeepAddonInstance,
} from '@embroider/shared-internals';
import Funnel from 'broccoli-funnel';
import buildFunnel from 'broccoli-funnel';
import type { Node } from 'broccoli-node-api';
import { satisfies } from 'semver';

Expand Down Expand Up @@ -88,7 +88,7 @@ export function addonV1Shim(directory: string, options: ShimOptions = {}) {
let maybeAppJS = meta['app-js'];
if (maybeAppJS) {
const appJS = maybeAppJS;
return new Funnel(rootTree(this), {
return buildFunnel(rootTree(this), {
files: Object.values(appJS),
getDestinationPath(relativePath: string): string {
for (let [exteriorName, interiorName] of Object.entries(appJS)) {
Expand Down Expand Up @@ -120,7 +120,7 @@ export function addonV1Shim(directory: string, options: ShimOptions = {}) {
let maybeAssets = meta['public-assets'];
if (maybeAssets) {
const assets = maybeAssets;
return new Funnel(rootTree(this), {
return buildFunnel(rootTree(this), {
files: Object.keys(assets),
getDestinationPath(relativePath: string): string {
for (let [interiorName, exteriorName] of Object.entries(assets)) {
Expand Down
4 changes: 2 additions & 2 deletions packages/compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
"broccoli": "^3.4.2",
"broccoli-concat": "^3.7.3",
"broccoli-file-creator": "^2.1.1",
"broccoli-funnel": "ef4/broccoli-funnel#c70d060076e14793e8495571f304a976afc754ac",
"broccoli-funnel": "^3.0.5",
"broccoli-merge-trees": "^3.0.0",
"broccoli-persistent-filter": "^3.1.2",
"broccoli-plugin": "^4.0.0",
"broccoli-plugin": "^4.0.7",
"broccoli-source": "^3.0.0",
"chalk": "^4.1.0",
"debug": "^3.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/compat/src/add-to-tree.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Node } from 'broccoli-node-api';
import Funnel from 'broccoli-funnel';
import { Funnel } from 'broccoli-funnel';

export default class AddToTree extends Funnel {
constructor(combinedVendor: Node, private hook: (outputPath: string) => Promise<void> | void) {
Expand Down
4 changes: 2 additions & 2 deletions packages/compat/src/build-compat-addon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SmooshPackageJSON from './smoosh-package-json';
import broccoliMergeTrees from 'broccoli-merge-trees';
import { Node } from 'broccoli-node-api';
import OneShot from './one-shot';
import Funnel from 'broccoli-funnel';
import buildFunnel from 'broccoli-funnel';
import { UnwatchedDir, WatchedDir } from 'broccoli-source';
import EmptyPackageTree from './empty-package-tree';

Expand Down Expand Up @@ -51,7 +51,7 @@ function buildCompatAddon(originalPackage: Package, v1Cache: V1InstanceCache): N

function withoutNodeModules(originalPackage: Package): Node {
let Klass = originalPackage.mayRebuild ? WatchedDir : UnwatchedDir;
return new Funnel(new Klass(originalPackage.root), {
return buildFunnel(new Klass(originalPackage.root), {
exclude: ['node_modules'],
});
}
4 changes: 2 additions & 2 deletions packages/compat/src/compat-adapters/ember-asset-loader.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import V1Addon from '../v1-addon';
import Funnel from 'broccoli-funnel';
import buildFunnel from 'broccoli-funnel';
import cloneDeep from 'lodash/cloneDeep';

// ember-asset-loader's ManifestGenerator (which is used as the Addon base class
Expand All @@ -14,7 +14,7 @@ import cloneDeep from 'lodash/cloneDeep';
// loading is a thing that is natively handled by embroider.
export default class extends V1Addon {
get v2Tree() {
return new Funnel(super.v2Tree, {
return buildFunnel(super.v2Tree, {
exclude: ['_app_/config/asset-manifest.js', '_app_/instance-initializers/load-asset-manifest.js'],
});
}
Expand Down
4 changes: 2 additions & 2 deletions packages/compat/src/compat-adapters/ember-cli-clipboard.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import V1Addon from '../v1-addon';
import { Memoize } from 'typescript-memoize';
import Funnel from 'broccoli-funnel';
import buildFunnel from 'broccoli-funnel';

export default class EmberCLIClipboard extends V1Addon {
@Memoize()
get v2Tree() {
let tree = super.v2Tree;
return new Funnel(tree, {
return buildFunnel(tree, {
// ember-cli-clipboard is wrapping *everything* in its vendor tree inside
// a fastboot guard, including a package.json file. The presence a file
// named "package.json" that isn't actually valid JSON makes packagers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { join, dirname } from 'path';
import { UnwatchedDir } from 'broccoli-source';
import resolve from 'resolve';
import { Memoize } from 'typescript-memoize';
import Funnel from 'broccoli-funnel';
import buildFunnel from 'broccoli-funnel';

export default class extends V1Addon {
@Memoize()
Expand All @@ -18,7 +18,7 @@ export default class extends V1Addon {
let polyfillDir = dirname(
resolve.sync('ember-debug-handlers-polyfill/package.json', { basedir: this.addonInstance.root })
);
let tree = new Funnel(new UnwatchedDir(join(polyfillDir, 'vendor')), {
let tree = buildFunnel(new UnwatchedDir(join(polyfillDir, 'vendor')), {
destDir: 'vendor',
});
let trees = super.v2Trees;
Expand Down
4 changes: 2 additions & 2 deletions packages/compat/src/compat-adapters/ember-cli-mirage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import V1Addon from '../v1-addon';
import Funnel from 'broccoli-funnel';
import buildFunnel from 'broccoli-funnel';
import { AddonMeta } from '@embroider/core';

export default class extends V1Addon {
Expand All @@ -19,7 +19,7 @@ export default class extends V1Addon {
if (this.addonInstance._shouldIncludeFiles()) {
return tree;
}
return new Funnel(tree, {
return buildFunnel(tree, {
include: ['package.json'],
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { join } from 'path';
import { Node } from 'broccoli-node-api';
import { readdirSync, writeFileSync, readFileSync } from 'fs';
import { pathExistsSync, removeSync } from 'fs-extra';
import Funnel from 'broccoli-funnel';
import { Funnel } from 'broccoli-funnel';
import { transform } from '@babel/core';
import { stripBadReexportsPlugin } from '../compat-utils';

Expand Down
8 changes: 4 additions & 4 deletions packages/compat/src/compat-adapters/ember-source.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import V1Addon from '../v1-addon';
import Funnel from 'broccoli-funnel';
import buildFunnel from 'broccoli-funnel';
import mergeTrees from 'broccoli-merge-trees';
import AddToTree from '../add-to-tree';
import { outputFileSync, unlinkSync } from 'fs-extra';
Expand All @@ -10,7 +10,7 @@ export default class extends V1Addon {
private useRealModules = semver.satisfies(this.packageJSON.version, '>=3.27.0-beta.0', { includePrerelease: true });

get v2Tree() {
return mergeTrees([super.v2Tree, new Funnel(this.rootTree, { include: ['dist/ember-template-compiler.js'] })]);
return mergeTrees([super.v2Tree, buildFunnel(this.rootTree, { include: ['dist/ember-template-compiler.js'] })]);
}

// when using real modules, we're replacing treeForAddon and treeForVendor
Expand All @@ -37,10 +37,10 @@ export default class extends V1Addon {
// supports that pattern of emitting modules into other package's namespaces.
private customAddonTree() {
return mergeTrees([
new Funnel(this.rootTree, {
buildFunnel(this.rootTree, {
srcDir: 'dist/packages',
}),
new Funnel(this.rootTree, {
buildFunnel(this.rootTree, {
srcDir: 'dist/dependencies',
}),
]);
Expand Down
6 changes: 3 additions & 3 deletions packages/compat/src/modules-compat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Funnel from 'broccoli-funnel';
import buildFunnel from 'broccoli-funnel';
import { Node } from 'broccoli-node-api';
import mergeTrees from 'broccoli-merge-trees';

Expand All @@ -8,7 +8,7 @@ import mergeTrees from 'broccoli-merge-trees';

export default function modulesCompat(tree: Node) {
return mergeTrees([
new Funnel(tree, { exclude: ['modules'] }),
new Funnel(tree, { srcDir: 'modules', allowEmpty: true }),
buildFunnel(tree, { exclude: ['modules'] }),
buildFunnel(tree, { srcDir: 'modules', allowEmpty: true }),
]);
}
2 changes: 1 addition & 1 deletion packages/compat/src/observe-tree.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Node } from 'broccoli-node-api';
import Funnel from 'broccoli-funnel';
import { Funnel } from 'broccoli-funnel';

export default class ObserveTree extends Funnel {
constructor(combinedVendor: Node, private hook: (outputPath: string) => Promise<void> | void) {
Expand Down
4 changes: 2 additions & 2 deletions packages/compat/src/rewrite-addon-tree.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Funnel from 'broccoli-funnel';
import buildFunnel from 'broccoli-funnel';
import mergeTrees from 'broccoli-merge-trees';
import Snitch from './snitch';
import { Node } from 'broccoli-node-api';
Expand Down Expand Up @@ -77,7 +77,7 @@ export default function rewriteAddonTree(
allowEmpty: true,
}
);
let badParts = new Funnel(tree, {
let badParts = buildFunnel(tree, {
exclude: [`${moduleName}/**`],
});
return {
Expand Down
2 changes: 1 addition & 1 deletion packages/compat/src/snitch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Funnel, { Options as FunnelOptions } from 'broccoli-funnel';
import { Funnel, Options as FunnelOptions } from 'broccoli-funnel';
import walkSync from 'walk-sync';
import { Node } from 'broccoli-node-api';

Expand Down
22 changes: 11 additions & 11 deletions packages/compat/src/v1-addon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Memoize } from 'typescript-memoize';
import { dirname, isAbsolute, join, relative } from 'path';
import { sync as pkgUpSync } from 'pkg-up';
import { existsSync, pathExistsSync } from 'fs-extra';
import Funnel, { Options as FunnelOptions } from 'broccoli-funnel';
import buildFunnel, { Options as FunnelOptions } from 'broccoli-funnel';
import { UnwatchedDir, WatchedDir } from 'broccoli-source';
import RewritePackageJSON from './rewrite-package-json';
import { todo, unsupported } from '@embroider/core/src/messages';
Expand Down Expand Up @@ -422,7 +422,7 @@ export default class V1Addon {
// legacy root
let srcDir = relative(this.root, join(this.addonInstance.root, this.addonInstance.treePaths[treeName]));
let opts = Object.assign({ srcDir }, this.stockTreeFunnelOptions(treeName));
return new Funnel(this.rootTree, opts);
return buildFunnel(this.rootTree, opts);
})!;
}

Expand Down Expand Up @@ -686,7 +686,7 @@ export default class V1Addon {
// this one doesn't go through transpile yet because it gets handled as
// part of the consuming app. For example, imports should be relative to
// the consuming app, not our own package.
return new Funnel(this.stockTree('test-support'), {
return buildFunnel(this.stockTree('test-support'), {
destDir: `${appPublicationDir}/tests`,
});
}
Expand Down Expand Up @@ -745,7 +745,7 @@ export default class V1Addon {
// around, which is actually what we want
tree = this.invokeOriginalTreeFor('styles');
if (tree) {
tree = new Funnel(tree, {
tree = buildFunnel(tree, {
destDir: '_app_styles_',
getDestinationPath(path) {
return path.replace(/^app\/styles\//, '');
Expand Down Expand Up @@ -818,7 +818,7 @@ export default class V1Addon {
if (this.customizes('treeForApp', 'treeForTemplates')) {
let original = this.invokeOriginalTreeFor('app');
if (original) {
appTree = new Funnel(original, {
appTree = buildFunnel(original, {
destDir: appPublicationDir,
});
}
Expand All @@ -842,7 +842,7 @@ export default class V1Addon {
if (hintTree) {
hintTree = this.maybeSetDirectoryMeta(
built,
new Funnel(hintTree, { destDir: appPublicationDir }),
buildFunnel(hintTree, { destDir: appPublicationDir }),
appPublicationDir,
'app-js'
);
Expand All @@ -866,15 +866,15 @@ export default class V1Addon {
// concept of "fastboot directory" because they can use the macro system to
// conditionally import some things only in fastboot.)
if (pathExistsSync(join(this.root, 'fastboot'))) {
tree = new Funnel(this.rootTree, { srcDir: 'fastboot' });
tree = buildFunnel(this.rootTree, { srcDir: 'fastboot' });
}
tree = this.addonInstance.treeForFastBoot(tree);
if (tree) {
tree = new Funnel(tree, { destDir: fastbootPublicationDir });
tree = buildFunnel(tree, { destDir: fastbootPublicationDir });
}
} else {
if (pathExistsSync(join(this.root, 'fastboot'))) {
tree = new Funnel(this.rootTree, { srcDir: 'fastboot', destDir: fastbootPublicationDir });
tree = buildFunnel(this.rootTree, { srcDir: 'fastboot', destDir: fastbootPublicationDir });
}
}

Expand All @@ -894,7 +894,7 @@ export default class V1Addon {
if (this.customizes('treeForPublic') && !this.isEngine()) {
let original = this.invokeOriginalTreeFor('public');
if (original) {
publicTree = new Funnel(original, {
publicTree = buildFunnel(original, {
destDir: 'public',
});
}
Expand Down Expand Up @@ -924,7 +924,7 @@ export default class V1Addon {
let tree = this.invokeOriginalTreeFor('vendor');
if (tree) {
built.trees.push(
new Funnel(tree, {
buildFunnel(tree, {
destDir: 'vendor',
})
);
Expand Down
Loading