Skip to content

Commit

Permalink
flatten the package caches
Browse files Browse the repository at this point in the history
  • Loading branch information
ef4 committed Mar 21, 2023
1 parent bcd0756 commit d7c17fe
Show file tree
Hide file tree
Showing 16 changed files with 26 additions and 377 deletions.
2 changes: 1 addition & 1 deletion packages/compat/src/compat-addons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default class CompatAddons implements Stage {
await this.deferReady.promise;
return {
outputPath: this.destDir,
packageCache: PackageCache.shared('embroider-stage1', this.inputPath),
packageCache: PackageCache.shared('embroider-unified', this.inputPath),
};
}

Expand Down
3 changes: 2 additions & 1 deletion packages/compat/src/compat-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ function setup(legacyEmberAppInstance: object, options: Required<Options>) {
appBootTree,
};

let instantiate = async (root: string, appSrcDir: string, packageCache: PackageCache) => {
let instantiate = async (root: string, appSrcDir: string) => {
let packageCache = PackageCache.shared('embroider-unified', appSrcDir);
let appPackage = packageCache.get(appSrcDir);
let adapter = new CompatAppAdapter(
root,
Expand Down
332 changes: 0 additions & 332 deletions packages/compat/src/moved-package-cache.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/compat/src/standalone-addon-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { Node } from 'broccoli-node-api';
export function convertLegacyAddons(emberApp: EmberAppInstance, maybeOptions?: Options) {
let options = optionsWithDefaults(maybeOptions);
let instanceCache = V1InstanceCache.forApp(emberApp, options);
let packageCache = PackageCache.shared('embroider-stage1', instanceCache.app.root);
let packageCache = PackageCache.shared('embroider-unified', instanceCache.app.root);
let v1Addons = findV1Addons(packageCache.get(instanceCache.app.root));

let addonIndex = Object.create(null);
Expand Down
8 changes: 4 additions & 4 deletions packages/compat/src/v1-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ import {
OutputFileToInputFileMap,
PackageInfo,
AddonInstance,
PackageCache,
} from '@embroider/core';
import { writeJSONSync, ensureDirSync, copySync, readdirSync, pathExistsSync, existsSync } from 'fs-extra';
import AddToTree from './add-to-tree';
import DummyPackage, { OwningAddon } from './dummy-package';
import { TransformOptions } from '@babel/core';
import { isEmbroiderMacrosPlugin, MacrosConfig } from '@embroider/macros/src/node';
import { isEmbroiderMacrosPlugin } from '@embroider/macros/src/node';
import resolvePackagePath from 'resolve-package-path';
import Concat from 'broccoli-concat';
import mapKeys from 'lodash/mapKeys';
Expand All @@ -30,7 +31,6 @@ import prepHtmlbarsAstPluginsForUnwrap from './prepare-htmlbars-ast-plugins';
import { readFileSync } from 'fs';
import type { Options as HTMLBarsOptions } from 'ember-cli-htmlbars';
import semver from 'semver';
import { MovablePackageCache } from './moved-package-cache';

import type { Transform } from 'babel-plugin-ember-template-compilation';

Expand Down Expand Up @@ -64,10 +64,10 @@ export default class V1App {
private _implicitScripts: string[] = [];
private _implicitStyles: string[] = [];

packageCache: MovablePackageCache;
packageCache: PackageCache;

protected constructor(protected app: EmberAppInstance) {
this.packageCache = new MovablePackageCache(MacrosConfig.for(app, this.root), this.root);
this.packageCache = PackageCache.shared('embroider-unified', this.root);
}

// always the name from package.json. Not the one that apps may have weirdly
Expand Down
Loading

0 comments on commit d7c17fe

Please sign in to comment.