Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@embroider/shared-internals

Package Overview
Dependencies
Maintainers
9
Versions
403
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@embroider/shared-internals - npm Package Compare versions

Comparing version 2.6.3 to 2.6.4-unstable.11ce470

src/colocation.d.ts

8

package.json
{
"name": "@embroider/shared-internals",
"version": "2.6.3",
"version": "2.6.4-unstable.11ce470",
"private": false,

@@ -16,4 +16,3 @@ "description": "Utilities shared among the other embroider packages",

},
"./src/babel-plugin-cache-busting.js": "./src/babel-plugin-cache-busting.js",
"./src/template-colocation-plugin": "./src/template-colocation-plugin.js"
"./src/*": "./src/*.js"
},

@@ -38,2 +37,3 @@ "license": "MIT",

"minimatch": "^3.0.4",
"resolve.exports": "^2.0.2",
"semver": "^7.3.5"

@@ -54,3 +54,3 @@ },

"tmp": "^0.1.0",
"typescript": "^5.1.6",
"typescript": "^5.4.5",
"@embroider/test-support": "0.36.0"

@@ -57,0 +57,0 @@ },

@@ -45,3 +45,3 @@ "use strict";

let ancestorsDep = ancestor.dependencies.find(d => d.name === dep.name);
if (ancestorsDep !== dep && dep.isEmberPackage()) {
if (ancestorsDep !== dep && dep.isEmberAddon()) {
violations.push({ pkg, dep, ancestors, ancestor, ancestorsDep });

@@ -48,0 +48,0 @@ }

@@ -57,2 +57,4 @@ "use strict";

exports.emberVirtualPackages.add('@glimmer/manager');
// ember-data pre 4.12 failed to declare this as a peer dependency of @ember-data/debug
exports.emberVirtualPeerDeps.add('@ember-data/store');
// These are the known names that people use to import template precomiplation

@@ -59,0 +61,0 @@ // macros from.

export { AppMeta, AddonMeta, PackageInfo } from './metadata';
export { explicitRelative, extensionsPattern, unrelativize, cleanUrl, correspondingTemplate } from './paths';
export { explicitRelative, extensionsPattern, unrelativize, cleanUrl, getUrlQueryParams, correspondingTemplate, } from './paths';
export { getOrCreate } from './get-or-create';

@@ -8,3 +8,2 @@ export { default as Package, V2AddonPackage as AddonPackage, V2AppPackage as AppPackage, V2Package } from './package';

export { RewrittenPackageCache } from './rewritten-package-cache';
export { default as babelFilter } from './babel-filter';
export { default as packageName } from './package-name';

@@ -19,1 +18,2 @@ export { default as tmpdir } from './tmpdir';

export * from './dep-validation';
export * from './colocation';

@@ -20,3 +20,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.locateEmbroiderWorkingDir = exports.cacheBustingPluginVersion = exports.cacheBustingPluginPath = exports.cacheBustingPlugin = exports.templateColocationPluginPath = exports.templateColocationPlugin = exports.hbsToJS = exports.tmpdir = exports.packageName = exports.babelFilter = exports.RewrittenPackageCache = exports.PackageCache = exports.Package = exports.getOrCreate = exports.correspondingTemplate = exports.cleanUrl = exports.unrelativize = exports.extensionsPattern = exports.explicitRelative = void 0;
exports.locateEmbroiderWorkingDir = exports.cacheBustingPluginVersion = exports.cacheBustingPluginPath = exports.cacheBustingPlugin = exports.templateColocationPluginPath = exports.templateColocationPlugin = exports.hbsToJS = exports.tmpdir = exports.packageName = exports.RewrittenPackageCache = exports.PackageCache = exports.Package = exports.getOrCreate = exports.correspondingTemplate = exports.getUrlQueryParams = exports.cleanUrl = exports.unrelativize = exports.extensionsPattern = exports.explicitRelative = void 0;
var paths_1 = require("./paths");

@@ -27,2 +27,3 @@ Object.defineProperty(exports, "explicitRelative", { enumerable: true, get: function () { return paths_1.explicitRelative; } });

Object.defineProperty(exports, "cleanUrl", { enumerable: true, get: function () { return paths_1.cleanUrl; } });
Object.defineProperty(exports, "getUrlQueryParams", { enumerable: true, get: function () { return paths_1.getUrlQueryParams; } });
Object.defineProperty(exports, "correspondingTemplate", { enumerable: true, get: function () { return paths_1.correspondingTemplate; } });

@@ -37,4 +38,2 @@ var get_or_create_1 = require("./get-or-create");

Object.defineProperty(exports, "RewrittenPackageCache", { enumerable: true, get: function () { return rewritten_package_cache_1.RewrittenPackageCache; } });
var babel_filter_1 = require("./babel-filter");
Object.defineProperty(exports, "babelFilter", { enumerable: true, get: function () { return __importDefault(babel_filter_1).default; } });
var package_name_1 = require("./package-name");

@@ -58,2 +57,3 @@ Object.defineProperty(exports, "packageName", { enumerable: true, get: function () { return __importDefault(package_name_1).default; } });

__exportStar(require("./dep-validation"), exports);
__exportStar(require("./colocation"), exports);
//# sourceMappingURL=index.js.map

@@ -8,8 +8,2 @@ type Filename = string;

assets: Filename[];
babel: {
filename: string;
isParallelSafe: boolean;
majorVersion: 7;
fileFilter: string;
};
'root-url': string;

@@ -16,0 +10,0 @@ version: 2;

@@ -67,2 +67,6 @@ "use strict";

let candidate = filename;
const virtualPrefix = 'embroider_virtual:';
if (candidate.includes(virtualPrefix)) {
candidate = candidate.replace(/^.*embroider_virtual:/, '');
}
// first we look through our cached packages for any that are rooted right

@@ -69,0 +73,0 @@ // at or above the file.

@@ -14,3 +14,3 @@ import type { AddonMeta, AppMeta, PackageInfo } from './metadata';

get meta(): AddonMeta | AppMeta | undefined;
isEmberPackage(): boolean;
isEmberAddon(): boolean;
isEngine(): boolean;

@@ -20,2 +20,3 @@ isLazyEngine(): boolean;

isV2App(): this is V2AppPackage;
needsLooseResolving(): boolean;
isV2Addon(): this is V2AddonPackage;

@@ -22,0 +23,0 @@ findDescendants(filter?: (pkg: Package) => boolean): Package[];

@@ -17,2 +17,30 @@ "use strict";

const flatMap_1 = __importDefault(require("lodash/flatMap"));
// This is controllable via env var because there are many different contexts
// (babel/rollup/vite/webpack/handlebars plugins) that can all depend on
// `@embroider/shared-internals` to help understand the structure of packages,
// and we want one clear way to signal to all of those whether this feature is
// configured.
//
// The initial motivating use case for this is that new-enough ember-source can
// function as a v2 addon despite not declaring itself to be a v2 addon, because
// that would be potentially-breaking for people who still consume it via AMD
// and/or depend on the specific timng of the classic vendor.js file. We don't
// want to break people but we also want people on the bleeding edge to be able
// to take advantage of the capability.
const forcedV2Packages = (() => {
let cached;
return () => {
if (!cached) {
if (typeof process !== undefined &&
typeof process.env !== undefined &&
process.env.EMBROIDER_FORCED_V2_PACKAGES) {
cached = process.env.EMBROIDER_FORCED_V2_PACKAGES.split(',');
}
else {
cached = [];
}
}
return cached;
};
})();
class Package {

@@ -46,2 +74,20 @@ constructor(root, packageCache, isApp) {

}
if (forcedV2Packages().includes(json.name)) {
let defaults;
if (this.isApp) {
defaults = {
version: 2,
type: 'app',
assets: [],
'root-url': '/',
};
}
else {
defaults = {
version: 2,
type: 'addon',
};
}
json['ember-addon'] = Object.assign(defaults, json['ember-addon']);
}
return json;

@@ -58,3 +104,3 @@ }

}
isEmberPackage() {
isEmberAddon() {
let keywords = this.packageJSON.keywords;

@@ -75,3 +121,4 @@ return Boolean(keywords && keywords.includes('ember-addon'));

isV2Ember() {
return this.isEmberPackage() && (0, get_1.default)(this.packageJSON, 'ember-addon.version') === 2;
return ((0, get_1.default)(this.packageJSON, 'ember-addon.version') === 2 &&
((0, get_1.default)(this.packageJSON, 'ember-addon.type') === 'app' || this.isEmberAddon()));
}

@@ -81,2 +128,6 @@ isV2App() {

}
needsLooseResolving() {
var _a;
return this.isV2App() || ((_a = (this.isV2Addon() && this.meta['auto-upgraded'])) !== null && _a !== void 0 ? _a : false);
}
isV2Addon() {

@@ -83,0 +134,0 @@ return this.isV2Ember() && this.packageJSON['ember-addon'].type === 'addon';

@@ -6,2 +6,3 @@ import type Package from './package';

export declare function cleanUrl(url: string): string;
export declare function getUrlQueryParams(url: string): string;
export declare function correspondingTemplate(filename: string): string;

@@ -7,2 +7,3 @@ "use strict";

exports.cleanUrl = cleanUrl;
exports.getUrlQueryParams = getUrlQueryParams;
exports.correspondingTemplate = correspondingTemplate;

@@ -21,3 +22,3 @@ const path_1 = require("path");

}
if ((0, path_1.isAbsolute)(toFile) && result.endsWith(toFile)) {
if ((0, path_1.isAbsolute)(toFile) && result.split(path_1.sep).join('/').endsWith(toFile)) {
// this prevents silly "relative" paths like

@@ -51,5 +52,13 @@ // "../../../../../Users/you/projects/your/stuff" when we could have just

// cache-busting query params from leaking where they shouldn't.
// includeHashSign true means #my-specifier is considered part of the pathname
function cleanUrl(url) {
return url.replace(postfixRE, '');
const regexp = postfixRE;
return url.replace(regexp, '');
}
// includeHashSign true means #my-specifier is considered part of the pathname
function getUrlQueryParams(url) {
var _a, _b;
const regexp = postfixRE;
return (_b = (_a = url.match(regexp)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : '';
}
// given a filename, returns it with the hbs extension

@@ -56,0 +65,0 @@ // for instance, passing filename.js returns filename.hbs

@@ -172,4 +172,4 @@ "use strict";

}
isEmberPackage() {
return this.plainPkg.isEmberPackage();
isEmberAddon() {
return this.plainPkg.isEmberAddon();
}

@@ -191,2 +191,5 @@ isEngine() {

}
needsLooseResolving() {
return this.plainPkg.needsLooseResolving();
}
// it's important that we're calling this.dependencies here at this level, not

@@ -193,0 +196,0 @@ // plainPkg.dependencies, which wouldn't be correct

@@ -31,3 +31,3 @@ "use strict";

let owningPackage = _1.PackageCache.shared('embroider', state.opts.appRoot).ownerOfFile(filename);
if (!owningPackage || !owningPackage.isV2Ember() || !owningPackage.meta['auto-upgraded']) {
if (!owningPackage || !owningPackage.needsLooseResolving()) {
debug('not handling colocation for %s', filename);

@@ -34,0 +34,0 @@ return;

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc