@embroider/shared-internals
Advanced tools
Comparing version 2.8.2-unstable.e6197c7 to 2.8.2-unstable.e73d3a7
{ | ||
"name": "@embroider/shared-internals", | ||
"version": "2.8.2-unstable.e6197c7", | ||
"version": "2.8.2-unstable.e73d3a7", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "Utilities shared among the other embroider packages", |
@@ -40,3 +40,3 @@ "use strict"; | ||
const pkg = packageCache.ownerOfFile(id); | ||
if (!(pkg === null || pkg === void 0 ? void 0 : pkg.isV2App())) { | ||
if (!(pkg === null || pkg === void 0 ? void 0 : pkg.isApp())) { | ||
return false; | ||
@@ -49,3 +49,3 @@ } | ||
let componentsDir = (_a = tryResolve === null || tryResolve === void 0 ? void 0 : tryResolve[0]) !== null && _a !== void 0 ? _a : './components'; | ||
return ('.' + id.slice(pkg === null || pkg === void 0 ? void 0 : pkg.root.length).split(path_1.sep).join('/')).startsWith(componentsDir); | ||
return (0, paths_1.explicitRelative)(pkg.root, id).split(path_1.sep).join('/').startsWith(componentsDir); | ||
} | ||
@@ -52,0 +52,0 @@ function templateOnlyComponentSource() { |
@@ -1,5 +0,5 @@ | ||
export { AppMeta, AddonMeta, PackageInfo } from './metadata'; | ||
export { AddonMeta, PackageInfo } from './metadata'; | ||
export { explicitRelative, extensionsPattern, unrelativize, cleanUrl, getUrlQueryParams, correspondingTemplate, } from './paths'; | ||
export { getOrCreate } from './get-or-create'; | ||
export { default as Package, V2AddonPackage as AddonPackage, V2AppPackage as AppPackage, V2Package } from './package'; | ||
export { default as Package, V2AddonPackage as AddonPackage } from './package'; | ||
export { default as PackageCache, type PackageCachePublicAPI } from './package-cache'; | ||
@@ -6,0 +6,0 @@ export type { RewrittenPackageIndex } from './rewritten-package-cache'; |
type Filename = string; | ||
type AppRelativeURL = string; | ||
export interface AppMeta { | ||
type: 'app'; | ||
main?: string; | ||
'auto-upgraded'?: true; | ||
assets: Filename[]; | ||
'root-url': string; | ||
version: 2; | ||
} | ||
export interface AddonMeta { | ||
type: 'addon'; | ||
main?: string; | ||
@@ -50,6 +41,5 @@ 'order-index'?: number; | ||
dependencies?: Record<string, string>; | ||
'ember-addon': AddonMeta | AppMeta | { | ||
'ember-addon': AddonMeta | { | ||
main?: string; | ||
version?: 1; | ||
type?: 'addon' | 'app'; | ||
paths?: string[]; | ||
@@ -56,0 +46,0 @@ before?: string | string[]; |
@@ -1,2 +0,2 @@ | ||
import type { AddonMeta, AppMeta, PackageInfo } from './metadata'; | ||
import type { AddonMeta, PackageInfo } from './metadata'; | ||
import type PackageCache from './package-cache'; | ||
@@ -6,5 +6,5 @@ export default class Package { | ||
protected packageCache: PackageCache; | ||
private isApp; | ||
private _isApp; | ||
private dependencyKeys; | ||
constructor(root: string, packageCache: PackageCache, isApp: boolean); | ||
constructor(root: string, packageCache: PackageCache, _isApp: boolean); | ||
get name(): string; | ||
@@ -14,8 +14,8 @@ get version(): string; | ||
get packageJSON(): PackageInfo; | ||
get meta(): AddonMeta | AppMeta | undefined; | ||
get meta(): AddonMeta | undefined; | ||
isEmberAddon(): boolean; | ||
isEngine(): boolean; | ||
isLazyEngine(): boolean; | ||
isV2Ember(): this is V2Package; | ||
isV2App(): this is V2AppPackage; | ||
isV2Ember(): boolean; | ||
isApp(): boolean; | ||
needsLooseResolving(): boolean; | ||
@@ -34,10 +34,4 @@ isV2Addon(): this is V2AddonPackage; | ||
} | ||
export interface V2Package extends Package { | ||
meta: AddonMeta | AppMeta; | ||
} | ||
export interface V2AddonPackage extends Package { | ||
meta: AddonMeta; | ||
} | ||
export interface V2AppPackage extends Package { | ||
meta: AppMeta; | ||
} |
@@ -46,7 +46,7 @@ "use strict"; | ||
class Package { | ||
constructor(root, packageCache, isApp) { | ||
constructor(root, packageCache, _isApp) { | ||
this.root = root; | ||
this.packageCache = packageCache; | ||
this.isApp = isApp; | ||
this.dependencyKeys = isApp | ||
this._isApp = _isApp; | ||
this.dependencyKeys = _isApp | ||
? ['dependencies', 'devDependencies', 'peerDependencies'] | ||
@@ -75,17 +75,5 @@ : ['dependencies', 'peerDependencies']; | ||
if (forcedV2Packages().includes(json.name)) { | ||
let defaults; | ||
if (this.isApp) { | ||
defaults = { | ||
version: 2, | ||
type: 'app', | ||
assets: [], | ||
'root-url': '/', | ||
}; | ||
} | ||
else { | ||
defaults = { | ||
version: 2, | ||
type: 'addon', | ||
}; | ||
} | ||
let defaults = { | ||
version: 2, | ||
}; | ||
json['ember-addon'] = Object.assign(defaults, json['ember-addon']); | ||
@@ -97,5 +85,2 @@ } | ||
let m = this.packageJSON['ember-addon']; | ||
if (this.isV2App()) { | ||
return m; | ||
} | ||
if (this.isV2Addon()) { | ||
@@ -110,3 +95,3 @@ return m; | ||
isEngine() { | ||
if (this.isApp) { | ||
if (this.isApp()) { | ||
// an app is implicitly an engine | ||
@@ -122,14 +107,14 @@ return true; | ||
isV2Ember() { | ||
return ((0, get_1.default)(this.packageJSON, 'ember-addon.version') === 2 && | ||
((0, get_1.default)(this.packageJSON, 'ember-addon.type') === 'app' || this.isEmberAddon())); | ||
return this.isApp() || this.isV2Addon(); | ||
} | ||
isV2App() { | ||
return this.isV2Ember() && this.packageJSON['ember-addon'].type === 'app'; | ||
isApp() { | ||
return this._isApp; | ||
} | ||
needsLooseResolving() { | ||
var _a; | ||
return this.isV2App() || ((_a = (this.isV2Addon() && this.meta['auto-upgraded'])) !== null && _a !== void 0 ? _a : false); | ||
return this.isApp() || ((_a = (this.isV2Addon() && this.meta['auto-upgraded'])) !== null && _a !== void 0 ? _a : false); | ||
} | ||
isV2Addon() { | ||
return this.isV2Ember() && this.packageJSON['ember-addon'].type === 'addon'; | ||
var _a; | ||
return this.isEmberAddon() && ((_a = this.packageJSON['ember-addon']) === null || _a === void 0 ? void 0 : _a.version) === 2; | ||
} | ||
@@ -136,0 +121,0 @@ findDescendants(filter) { |
@@ -184,4 +184,4 @@ "use strict"; | ||
} | ||
isV2App() { | ||
return this.plainPkg.isV2App(); | ||
isApp() { | ||
return this.plainPkg.isApp(); | ||
} | ||
@@ -188,0 +188,0 @@ isV2Addon() { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
268343
8
22
4
156
170962
1681