@embroider/core 3.1.2 → 3.1.3-unstable.1cfdcec

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embroider/core",
3
- "version": "3.1.2",
3
+ "version": "3.1.3-unstable.1cfdcec",
4
4
  "private": false,
5
5
  "description": "A build system for EmberJS applications.",
6
6
  "repository": {
@@ -16,10 +16,15 @@
16
16
  "src/**/*.d.ts",
17
17
  "src/**/*.js.map"
18
18
  ],
19
+ "scripts": {
20
+ "test": "jest"
21
+ },
19
22
  "dependencies": {
20
23
  "@babel/core": "^7.14.5",
21
24
  "@babel/parser": "^7.14.5",
22
25
  "@babel/traverse": "^7.14.5",
26
+ "@embroider/macros": "1.12.3-unstable.1cfdcec",
27
+ "@embroider/shared-internals": "2.2.3-unstable.1cfdcec",
23
28
  "assert-never": "^1.2.1",
24
29
  "babel-plugin-ember-template-compilation": "^2.0.0",
25
30
  "broccoli-node-api": "^1.7.0",
@@ -38,11 +43,11 @@
38
43
  "resolve": "^1.20.0",
39
44
  "resolve-package-path": "^4.0.1",
40
45
  "typescript-memoize": "^1.0.1",
41
- "walk-sync": "^3.0.0",
42
- "@embroider/macros": "1.12.2",
43
- "@embroider/shared-internals": "2.2.2"
46
+ "walk-sync": "^3.0.0"
44
47
  },
45
48
  "devDependencies": {
49
+ "@embroider/sample-transforms": "workspace:*",
50
+ "@embroider/test-support": "workspace:*",
46
51
  "@glimmer/syntax": "^0.84.2",
47
52
  "@glint/template": "^1.0.0",
48
53
  "@types/babel__core": "^7.1.14",
@@ -57,17 +62,12 @@
57
62
  "@types/tmp": "^0.1.0",
58
63
  "fixturify": "^2.1.1",
59
64
  "tmp": "^0.1.0",
60
- "typescript": "^4.9.0",
61
- "@embroider/sample-transforms": "0.0.0",
62
- "@embroider/test-support": "0.36.0"
65
+ "typescript": "^4.9.0"
63
66
  },
64
67
  "engines": {
65
68
  "node": "12.* || 14.* || >= 16"
66
69
  },
67
70
  "volta": {
68
71
  "extends": "../../package.json"
69
- },
70
- "scripts": {
71
- "test": "jest"
72
72
  }
73
- }
73
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2018 Edward Faulkner
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,11 +0,0 @@
1
- import { AddonPackage } from '@embroider/shared-internals';
2
- export default class AppDiffer {
3
- private differ;
4
- private sources;
5
- private firstFastbootTree;
6
- readonly files: Set<string>;
7
- isFastbootOnly: Map<string, boolean>;
8
- constructor(ownAppJSDir: string, activeAddonDescendants: AddonPackage[], fastbootEnabled?: boolean, ownFastbootJSDir?: string | undefined);
9
- update(): void;
10
- private updateFiles;
11
- }
package/src/app-differ.js DELETED
@@ -1,178 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const multi_tree_diff_1 = __importDefault(require("./multi-tree-diff"));
7
- const walk_sync_1 = __importDefault(require("walk-sync"));
8
- const path_1 = require("path");
9
- const messages_1 = require("./messages");
10
- const assert_never_1 = __importDefault(require("assert-never"));
11
- const fs_1 = require("fs");
12
- const util_1 = require("util");
13
- class AppDiffer {
14
- constructor(ownAppJSDir, activeAddonDescendants,
15
- // arguments below this point are only needed in fastboot mode. Fastboot
16
- // makes this pretty messy because fastboot trees all merge into the app 🤮.
17
- fastbootEnabled = false, ownFastbootJSDir) {
18
- this.firstFastbootTree = Infinity;
19
- // set of filenames logically located in the app
20
- this.files = new Set();
21
- // true for files that are fastboot-only.
22
- this.isFastbootOnly = new Map();
23
- this.sources = activeAddonDescendants.map(addon => maybeSource(addon, 'app-js')).filter(Boolean);
24
- this.sources.push({
25
- mayChange: true,
26
- walk() {
27
- return walk_sync_1.default.entries(ownAppJSDir);
28
- },
29
- isRelocated: false,
30
- locate(relativePath) {
31
- return (0, path_1.resolve)(ownAppJSDir, relativePath);
32
- },
33
- });
34
- if (!fastbootEnabled) {
35
- this.differ = new multi_tree_diff_1.default(this.sources, lastOneWins);
36
- return;
37
- }
38
- this.firstFastbootTree = this.sources.length;
39
- for (let addon of activeAddonDescendants) {
40
- let source = maybeSource(addon, 'fastboot-js');
41
- if (source) {
42
- this.sources.push(source);
43
- }
44
- }
45
- if (ownFastbootJSDir) {
46
- this.sources.push({
47
- mayChange: true,
48
- walk() {
49
- return walk_sync_1.default.entries(ownFastbootJSDir);
50
- },
51
- isRelocated: false,
52
- locate(relativePath) {
53
- return (0, path_1.resolve)(ownFastbootJSDir, relativePath);
54
- },
55
- });
56
- }
57
- this.differ = new multi_tree_diff_1.default(this.sources, fastbootMerge(this.firstFastbootTree));
58
- }
59
- update() {
60
- let { ops, sources } = this.differ.update();
61
- (0, messages_1.debug)(`app-differ operations count: %s`, ops.length);
62
- for (let [operation, relativePath] of ops) {
63
- switch (operation) {
64
- case 'unlink':
65
- this.files.delete(relativePath);
66
- break;
67
- case 'rmdir':
68
- case 'mkdir':
69
- case 'change':
70
- // this used to actually write to disk but we have moved the functionality into the resolver code
71
- break;
72
- case 'create':
73
- let sourceIndices = sources.get(relativePath);
74
- if (sourceIndices.length === 1) {
75
- // a single file won. whether it's fastboot or non-fastboot doesn't
76
- // actually change what we do here. It gets emitted in the app's
77
- // namespace (if it's fastboot-only, non-fastboot code shouldn't be
78
- // trying to import it anyway, because that would have already been
79
- // an error pre-embroider).
80
- this.isFastbootOnly.set(relativePath, sourceIndices[0] >= this.firstFastbootTree);
81
- this.updateFiles(relativePath);
82
- }
83
- else {
84
- // we have both fastboot and non-fastboot files for this path.
85
- // Because of the way fastbootMerge is written, the first one is the
86
- // non-fastboot.
87
- this.isFastbootOnly.set(relativePath, false);
88
- this.updateFiles(relativePath);
89
- }
90
- break;
91
- default:
92
- (0, assert_never_1.default)(operation);
93
- }
94
- }
95
- }
96
- updateFiles(relativePath) {
97
- this.files.add(relativePath);
98
- }
99
- }
100
- exports.default = AppDiffer;
101
- function lastOneWins(treeIds) {
102
- return treeIds.slice(-1);
103
- }
104
- function fastbootMerge(firstFastbootTree) {
105
- return function _fastbootMerge(treeIds) {
106
- let mainWinner, fastbootWinner;
107
- for (let id of treeIds) {
108
- if (id < firstFastbootTree) {
109
- mainWinner = id;
110
- }
111
- else {
112
- fastbootWinner = id;
113
- }
114
- }
115
- if (mainWinner != null && fastbootWinner != null) {
116
- return [mainWinner, fastbootWinner];
117
- }
118
- else if (mainWinner != null) {
119
- return [mainWinner];
120
- }
121
- else if (fastbootWinner != null) {
122
- return [fastbootWinner];
123
- }
124
- else {
125
- throw new Error(`bug: should always have at least one winner in fastbootMerge`);
126
- }
127
- };
128
- }
129
- function maybeSource(addon, key) {
130
- let maybeFiles = addon.meta[key];
131
- if (maybeFiles) {
132
- let files = maybeFiles;
133
- return {
134
- mayChange: addon.mayRebuild,
135
- walk() {
136
- return Object.entries(files).map(([externalName, internalName]) => {
137
- try {
138
- let stat = (0, fs_1.statSync)((0, path_1.resolve)(addon.root, internalName));
139
- return {
140
- relativePath: withoutMandatoryDotSlash(externalName, [
141
- 'in package.json at %s in key ember-addon.%s',
142
- addon.root,
143
- key,
144
- ]),
145
- mode: stat.mode,
146
- size: stat.size,
147
- mtime: stat.mtime,
148
- isDirectory() {
149
- return false;
150
- },
151
- };
152
- }
153
- catch (err) {
154
- if (err.code === 'ENOENT') {
155
- throw new Error(`${addon.name}/package.json lists ${internalName} in ember-addon.${key}, but that file does not exist`);
156
- }
157
- throw err;
158
- }
159
- });
160
- },
161
- isRelocated: true,
162
- locate(relativePath) {
163
- let internal = files['./' + relativePath];
164
- if (!internal) {
165
- throw new Error(`bug: couldn't find ${relativePath} in ${JSON.stringify(files)}`);
166
- }
167
- return (0, path_1.resolve)(addon.root, internal);
168
- },
169
- };
170
- }
171
- }
172
- function withoutMandatoryDotSlash(filename, debugInfo) {
173
- if (!filename.startsWith('./')) {
174
- throw new Error(`${(0, util_1.format)(debugInfo)}: ${filename} is required to start with "./"`);
175
- }
176
- return filename.slice(2);
177
- }
178
- //# sourceMappingURL=app-differ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app-differ.js","sourceRoot":"","sources":["app-differ.ts"],"names":[],"mappings":";;;;;AACA,wEAA6D;AAC7D,0DAAiC;AACjC,+BAA+B;AAC/B,yCAAmC;AACnC,gEAAuC;AACvC,2BAA8B;AAC9B,+BAA8B;AAE9B,MAAqB,SAAS;IAW5B,YACE,WAAmB,EACnB,sBAAsC;IACtC,wEAAwE;IACxE,4EAA4E;IAC5E,eAAe,GAAG,KAAK,EACvB,gBAAqC;QAd/B,sBAAiB,GAAG,QAAQ,CAAC;QAErC,gDAAgD;QACvC,UAAK,GAAgB,IAAI,GAAG,EAAE,CAAC;QAExC,yCAAyC;QACzC,mBAAc,GAAyB,IAAI,GAAG,EAAE,CAAC;QAU/C,IAAI,CAAC,OAAO,GAAG,sBAAsB,CAA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sourcesContent":["import { AddonPackage } from '@embroider/shared-internals';\nimport MultiTreeDiff, { InputTree } from './multi-tree-diff';\nimport walkSync from 'walk-sync';\nimport { resolve } from 'path';\nimport { debug } from './messages';\nimport assertNever from 'assert-never';\nimport { statSync } from 'fs';\nimport { format } from 'util';\n\nexport default class AppDiffer {\n private differ: MultiTreeDiff;\n private sources: Source[];\n private firstFastbootTree = Infinity;\n\n // set of filenames logically located in the app\n readonly files: Set<string> = new Set();\n\n // true for files that are fastboot-only.\n isFastbootOnly: Map<string, boolean> = new Map();\n\n constructor(\n ownAppJSDir: string,\n activeAddonDescendants: AddonPackage[],\n // arguments below this point are only needed in fastboot mode. Fastboot\n // makes this pretty messy because fastboot trees all merge into the app 🤮.\n fastbootEnabled = false,\n ownFastbootJSDir?: string | undefined\n ) {\n this.sources = activeAddonDescendants.map(addon => maybeSource(addon, 'app-js')).filter(Boolean) as Source[];\n\n this.sources.push({\n mayChange: true,\n walk() {\n return walkSync.entries(ownAppJSDir);\n },\n isRelocated: false,\n locate(relativePath: string) {\n return resolve(ownAppJSDir, relativePath);\n },\n });\n\n if (!fastbootEnabled) {\n this.differ = new MultiTreeDiff(this.sources, lastOneWins);\n return;\n }\n\n this.firstFastbootTree = this.sources.length;\n for (let addon of activeAddonDescendants) {\n let source = maybeSource(addon, 'fastboot-js');\n if (source) {\n this.sources.push(source);\n }\n }\n if (ownFastbootJSDir) {\n this.sources.push({\n mayChange: true,\n walk() {\n return walkSync.entries(ownFastbootJSDir);\n },\n isRelocated: false,\n locate(relativePath) {\n return resolve(ownFastbootJSDir, relativePath);\n },\n });\n }\n this.differ = new MultiTreeDiff(this.sources, fastbootMerge(this.firstFastbootTree));\n }\n\n update() {\n let { ops, sources } = this.differ.update();\n debug(`app-differ operations count: %s`, ops.length);\n for (let [operation, relativePath] of ops) {\n switch (operation) {\n case 'unlink':\n this.files.delete(relativePath);\n break;\n case 'rmdir':\n case 'mkdir':\n case 'change':\n // this used to actually write to disk but we have moved the functionality into the resolver code\n break;\n case 'create':\n let sourceIndices = sources.get(relativePath)!;\n if (sourceIndices.length === 1) {\n // a single file won. whether it's fastboot or non-fastboot doesn't\n // actually change what we do here. It gets emitted in the app's\n // namespace (if it's fastboot-only, non-fastboot code shouldn't be\n // trying to import it anyway, because that would have already been\n // an error pre-embroider).\n this.isFastbootOnly.set(relativePath, sourceIndices[0] >= this.firstFastbootTree);\n this.updateFiles(relativePath);\n } else {\n // we have both fastboot and non-fastboot files for this path.\n // Because of the way fastbootMerge is written, the first one is the\n // non-fastboot.\n this.isFastbootOnly.set(relativePath, false);\n this.updateFiles(relativePath);\n }\n break;\n default:\n assertNever(operation);\n }\n }\n }\n\n private updateFiles(relativePath: string) {\n this.files.add(relativePath);\n }\n}\n\nfunction lastOneWins(treeIds: number[]) {\n return treeIds.slice(-1);\n}\n\nfunction fastbootMerge(firstFastbootTree: number) {\n return function _fastbootMerge(treeIds: number[]): number[] {\n let mainWinner, fastbootWinner;\n for (let id of treeIds) {\n if (id < firstFastbootTree) {\n mainWinner = id;\n } else {\n fastbootWinner = id;\n }\n }\n if (mainWinner != null && fastbootWinner != null) {\n return [mainWinner, fastbootWinner];\n } else if (mainWinner != null) {\n return [mainWinner];\n } else if (fastbootWinner != null) {\n return [fastbootWinner];\n } else {\n throw new Error(`bug: should always have at least one winner in fastbootMerge`);\n }\n };\n}\n\ninterface Source extends InputTree {\n // find the real on disk location of the file that is presented externally as\n // `relativePath`\n locate(relativePath: string): string;\n\n // true if this source relocates its file out of their original package,\n // meaning we will need to track them in order to adjust package resolution\n isRelocated: boolean;\n}\n\nfunction maybeSource(addon: AddonPackage, key: 'app-js' | 'fastboot-js'): Source | undefined {\n let maybeFiles = addon.meta[key];\n if (maybeFiles) {\n let files = maybeFiles;\n return {\n mayChange: addon.mayRebuild,\n walk() {\n return Object.entries(files).map(([externalName, internalName]) => {\n try {\n let stat = statSync(resolve(addon.root, internalName));\n return {\n relativePath: withoutMandatoryDotSlash(externalName, [\n 'in package.json at %s in key ember-addon.%s',\n addon.root,\n key,\n ]),\n mode: stat.mode,\n size: stat.size,\n mtime: stat.mtime,\n isDirectory() {\n return false;\n },\n };\n } catch (err) {\n if (err.code === 'ENOENT') {\n throw new Error(\n `${addon.name}/package.json lists ${internalName} in ember-addon.${key}, but that file does not exist`\n );\n }\n throw err;\n }\n });\n },\n isRelocated: true,\n locate(relativePath: string) {\n let internal = files['./' + relativePath];\n if (!internal) {\n throw new Error(`bug: couldn't find ${relativePath} in ${JSON.stringify(files)}`);\n }\n return resolve(addon.root, internal);\n },\n };\n }\n}\n\nfunction withoutMandatoryDotSlash(filename: string, debugInfo: any[]): string {\n if (!filename.startsWith('./')) {\n throw new Error(`${format(debugInfo)}: ${filename} is required to start with \"./\"`);\n }\n return filename.slice(2);\n}\n"]}
package/src/app.d.ts DELETED
@@ -1,94 +0,0 @@
1
- import { Package, AddonPackage } from '@embroider/shared-internals';
2
- import { OutputPaths } from './wait-for-trees';
3
- import { Asset } from './asset';
4
- import Options from './options';
5
- import { MacrosConfig } from '@embroider/macros/src/node';
6
- import { PluginItem, TransformOptions } from '@babel/core';
7
- import { Options as ResolverConfig } from './module-resolver';
8
- import { Engine } from './app-files';
9
- import type { Transform } from 'babel-plugin-ember-template-compilation';
10
- export type EmberENV = unknown;
11
- export interface AppAdapter<TreeNames, SpecificResolverConfig extends ResolverConfig = ResolverConfig> {
12
- readonly allActiveAddons: AddonPackage[];
13
- activeAddonChildren(pkg: Package): AddonPackage[];
14
- appJSSrcDir(treePaths: OutputPaths<TreeNames>): string;
15
- fastbootJSSrcDir(treePaths: OutputPaths<TreeNames>): string | undefined;
16
- assets(treePaths: OutputPaths<TreeNames>): Asset[];
17
- autoRun(): boolean;
18
- appBoot(): string | undefined;
19
- mainModule(): string;
20
- mainModuleConfig(): unknown;
21
- modulePrefix(): string;
22
- podModulePrefix(): string | undefined;
23
- rootURL(): string;
24
- templateCompilerPath(): string;
25
- hbsTransforms(resolverConfig: SpecificResolverConfig): Transform[];
26
- jsPlugins(resolverConfig: SpecificResolverConfig): PluginItem[];
27
- resolverConfig(engines: Engine[]): SpecificResolverConfig;
28
- resolvableExtensions(): string[];
29
- htmlbarsPlugins(): Transform[];
30
- babelConfig(): TransformOptions;
31
- babelMajorVersion(): 7;
32
- emberENV(): EmberENV;
33
- strictV2Format(): boolean;
34
- developingAddons(): string[];
35
- env: string;
36
- }
37
- export declare function excludeDotFiles(files: string[]): string[];
38
- export declare const CACHE_BUSTING_PLUGIN: {
39
- path: string;
40
- version: any;
41
- };
42
- export declare function addCachablePlugin(babelConfig: TransformOptions): void;
43
- export declare class AppBuilder<TreeNames> {
44
- private root;
45
- private app;
46
- private adapter;
47
- private options;
48
- private macrosConfig;
49
- private assets;
50
- constructor(root: string, app: Package, adapter: AppAdapter<TreeNames>, options: Required<Options>, macrosConfig: MacrosConfig);
51
- private scriptPriority;
52
- private get resolvableExtensionsPattern();
53
- private impliedAssets;
54
- private impliedAddonAssets;
55
- private babelParserConfig;
56
- private babelConfig;
57
- private insertEmberApp;
58
- private implicitScriptsAsset;
59
- private implicitStylesAsset;
60
- private implicitTestScriptsAsset;
61
- private implicitTestStylesAsset;
62
- private findActiveAddons;
63
- private partitionEngines;
64
- private get activeFastboot();
65
- private get fastbootConfig();
66
- private appDiffers;
67
- private updateAppJS;
68
- private prepareAsset;
69
- private prepareAssets;
70
- private assetIsValid;
71
- private updateOnDiskAsset;
72
- private updateInMemoryAsset;
73
- private updateBuiltEmberAsset;
74
- private updateConcatenatedAsset;
75
- private updateAssets;
76
- private gatherAssets;
77
- build(inputPaths: OutputPaths<TreeNames>): Promise<void>;
78
- private combinePackageJSON;
79
- private etcOptions;
80
- private get portableHints();
81
- private addBabelConfig;
82
- private addResolverConfig;
83
- private shouldSplitRoute;
84
- private splitRoute;
85
- private topAppJSAsset;
86
- private get staticAppPathsPattern();
87
- private requiredOtherFiles;
88
- private appJSAsset;
89
- private get modulePrefix();
90
- private importPaths;
91
- private routeEntrypoint;
92
- private testJSEntrypoint;
93
- private gatherImplicitModules;
94
- }