Skip to content

Commit

Permalink
Merge pull request #1302 from void-mAlex/glimmer-tracking-index.js-mi…
Browse files Browse the repository at this point in the history
…ssing-on-windows

for embroider server running on windows, index.js can be ejected from …
  • Loading branch information
ef4 authored Dec 6, 2022
2 parents 3d6fb98 + 5c0f3d7 commit cbda288
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions packages/compat/src/compat-adapters/@glimmer/tracking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,20 @@ import { outputFileSync, copyFileSync } from 'fs-extra';
reexport the things from ember that are needed.
*/
class RedirectToEmber extends Plugin {
private didBuild = false;

build() {
if (!this.didBuild) {
copyFileSync(join(this.inputPaths[0], 'package.json'), join(this.outputPath, 'package.json'));
outputFileSync(
join(this.outputPath, 'index.js'),
// Prior to ember-source 4.1, cached didn't exist
// using this way of importing from metal, cached will be undefined if pre 4.1
`import * as metal from "@ember/-internals/metal";
const { cached, tracked } = metal;
export { cached, tracked };`
);
outputFileSync(
join(this.outputPath, 'primitives', 'cache.js'),
`export { createCache, getValue, isConst } from "@ember/-internals/metal";`
);
this.didBuild = true;
}
copyFileSync(join(this.inputPaths[0], 'package.json'), join(this.outputPath, 'package.json'));
outputFileSync(
join(this.outputPath, 'index.js'),
// Prior to ember-source 4.1, cached didn't exist
// using this way of importing from metal, cached will be undefined if pre 4.1
`import * as metal from "@ember/-internals/metal";
const { cached, tracked } = metal;
export { cached, tracked };`
);
outputFileSync(
join(this.outputPath, 'primitives', 'cache.js'),
`export { createCache, getValue, isConst } from "@ember/-internals/metal";`
);
}
}

Expand Down

0 comments on commit cbda288

Please sign in to comment.