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

@embroider/shared-internals

Package Overview
Dependencies
Maintainers
7
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.1.0 to 2.1.1-unstable.3030376

src/rewritten-package-cache.d.ts

14

package.json
{
"name": "@embroider/shared-internals",
"version": "2.1.0",
"version": "2.1.1-unstable.3030376",
"private": false,

@@ -27,2 +27,5 @@ "description": "Utilities shared among the other embroider packages",

],
"scripts": {
"test": "jest"
},
"dependencies": {

@@ -40,2 +43,3 @@ "babel-import-util": "^1.1.0",

"broccoli-node-api": "^1.7.0",
"@embroider/test-support": "workspace:*",
"@types/babel__core": "^7.1.14",

@@ -50,4 +54,3 @@ "@types/babel__traverse": "^7.18.5",

"tmp": "^0.1.0",
"typescript": "^4.9.0",
"@embroider/test-support": "0.36.0"
"typescript": "^4.9.0"
},

@@ -59,6 +62,3 @@ "engines": {

"extends": "../../package.json"
},
"scripts": {
"test": "jest"
}
}
}

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

}
let owner = package_cache_1.default.shared('embroider-stage3', appRoot).ownerOfFile(filename);
let owner = package_cache_1.default.shared('embroider', appRoot).ownerOfFile(filename);
if (owner) {

@@ -17,0 +17,0 @@ for (let { package: pkg, semverRange } of skipBabel) {

export default function makePlugin(): any;
export declare const pluginPath: string;
export declare const version: any;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = exports.pluginPath = void 0;
const fs_extra_1 = require("fs-extra");
function makePlugin() {

@@ -15,2 +17,4 @@ // Dear future @rwjblue,

exports.default = makePlugin;
exports.pluginPath = __filename;
exports.version = (0, fs_extra_1.readJSONSync)(`${__dirname}/../package.json`);
//# sourceMappingURL=babel-plugin-cache-busting.js.map

@@ -6,2 +6,4 @@ export { AppMeta, AddonMeta, PackageInfo } from './metadata';

export { default as PackageCache } from './package-cache';
export type { RewrittenPackageIndex } from './rewritten-package-cache';
export { RewrittenPackageCache } from './rewritten-package-cache';
export { default as babelFilter } from './babel-filter';

@@ -13,2 +15,4 @@ export { default as packageName } from './package-name';

export { hbsToJS } from './hbs-to-js';
export { default as templateColocationPlugin, Options as TemplateColocationPluginOptions, } from './template-colocation-plugin';
export { default as templateColocationPlugin, Options as TemplateColocationPluginOptions, pluginPath as templateColocationPluginPath, } from './template-colocation-plugin';
export { default as cacheBustingPlugin, pluginPath as cacheBustingPluginPath, version as cacheBustingPluginVersion, } from './babel-plugin-cache-busting';
export { locateEmbroiderWorkingDir } from './working-dir';

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.templateColocationPlugin = exports.hbsToJS = exports.tmpdir = exports.packageName = exports.babelFilter = exports.PackageCache = exports.Package = exports.getOrCreate = 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.babelFilter = exports.RewrittenPackageCache = exports.PackageCache = exports.Package = exports.getOrCreate = exports.unrelativize = exports.extensionsPattern = exports.explicitRelative = void 0;
var paths_1 = require("./paths");

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

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

@@ -45,2 +47,9 @@ Object.defineProperty(exports, "babelFilter", { enumerable: true, get: function () { return __importDefault(babel_filter_1).default; } });

Object.defineProperty(exports, "templateColocationPlugin", { enumerable: true, get: function () { return __importDefault(template_colocation_plugin_1).default; } });
Object.defineProperty(exports, "templateColocationPluginPath", { enumerable: true, get: function () { return template_colocation_plugin_1.pluginPath; } });
var babel_plugin_cache_busting_1 = require("./babel-plugin-cache-busting");
Object.defineProperty(exports, "cacheBustingPlugin", { enumerable: true, get: function () { return __importDefault(babel_plugin_cache_busting_1).default; } });
Object.defineProperty(exports, "cacheBustingPluginPath", { enumerable: true, get: function () { return babel_plugin_cache_busting_1.pluginPath; } });
Object.defineProperty(exports, "cacheBustingPluginVersion", { enumerable: true, get: function () { return babel_plugin_cache_busting_1.version; } });
var working_dir_1 = require("./working-dir");
Object.defineProperty(exports, "locateEmbroiderWorkingDir", { enumerable: true, get: function () { return working_dir_1.locateEmbroiderWorkingDir; } });
//# sourceMappingURL=index.js.map

@@ -6,10 +6,7 @@ import Package from './package';

resolve(packageName: string, fromPackage: Package): Package;
seed(pkg: Package): void;
protected rootCache: Map<string, Package>;
protected resolutionCache: Map<Package, Map<string, Package | null>>;
basedir(pkg: Package): string;
private rootCache;
private resolutionCache;
get(packageRoot: string): Package;
ownerOfFile(filename: string): Package | undefined;
shareAs(identifier: string): void;
static shared(identifier: string, appRoot: string): PackageCache;
}

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

// the type cast is needed because resolvePackagePath itself is erroneously typed as `any`.
let packagePath = (0, resolve_package_path_1.default)(packageName, this.basedir(fromPackage));
let packagePath = (0, resolve_package_path_1.default)(packageName, fromPackage.root);
if (!packagePath) {

@@ -37,11 +37,2 @@ // this gets our null into the cache so we don't keep trying to resolve

}
seed(pkg) {
if (this.rootCache.has(pkg.root)) {
throw new Error(`bug: tried to seed package ${pkg.name} but it's already in packageCache`);
}
this.rootCache.set(pkg.root, pkg);
}
basedir(pkg) {
return pkg.root;
}
get(packageRoot) {

@@ -74,8 +65,6 @@ let root = (0, fs_1.realpathSync)(packageRoot);

}
// register to be shared as the per-process package cache with the given name
shareAs(identifier) {
shared.set(identifier, this);
}
static shared(identifier, appRoot) {
let pk = (0, get_or_create_1.getOrCreate)(shared, identifier + appRoot, () => new PackageCache(appRoot));
// it's not clear that this could ever happen because appRoot is part of the new identifier
// but it doesn't cost much to leave this code here.
if (pk.appRoot !== appRoot) {

@@ -82,0 +71,0 @@ throw new Error(`bug: PackageCache appRoot disagreement ${appRoot}!=${pk.appRoot}`);

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

protected packageCache: PackageCache;
private isApp;
private dependencyKeys;

@@ -23,2 +24,3 @@ constructor(root: string, packageCache: PackageCache, isApp: boolean);

get nonResolvableDeps(): Map<string, Package> | undefined;
get dependencyNames(): string[];
get dependencies(): Package[];

@@ -25,0 +27,0 @@ hasDependency(name: string): boolean;

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

this.packageCache = packageCache;
this.isApp = isApp;
this.dependencyKeys = isApp

@@ -61,2 +62,6 @@ ? ['dependencies', 'devDependencies', 'peerDependencies']

isEngine() {
if (this.isApp) {
// an app is implicitly an engine
return true;
}
let keywords = this.packageJSON.keywords;

@@ -130,3 +135,3 @@ return Boolean(keywords && keywords.includes('ember-engine'));

try {
pkg = this.packageCache.get((0, path_1.join)(this.packageCache.basedir(this), path));
pkg = this.packageCache.get((0, path_1.join)(this.root, path));
main = ((_a = pkg.packageJSON['ember-addon']) === null || _a === void 0 ? void 0 : _a.main) || pkg.packageJSON['main'];

@@ -144,3 +149,3 @@ }

}
let mainPath = (0, path_1.join)(this.packageCache.basedir(this), path, main);
let mainPath = (0, path_1.join)(this.root, path, main);
if (!(0, fs_extra_1.existsSync)(mainPath)) {

@@ -155,5 +160,7 @@ // package has no valid main

}
get dependencyNames() {
return (0, flatMap_1.default)(this.dependencyKeys, key => Object.keys(this.packageJSON[key] || {}));
}
get dependencies() {
let names = (0, flatMap_1.default)(this.dependencyKeys, key => Object.keys(this.packageJSON[key] || {}));
return names
return this.dependencyNames
.map(name => {

@@ -160,0 +167,0 @@ if (this.nonResolvableDeps) {

@@ -5,2 +5,3 @@ import type { NodePath } from '@babel/traverse';

import { ImportUtil } from 'babel-import-util';
export declare const pluginPath: string;
export interface Options {

@@ -7,0 +8,0 @@ packageGuard?: boolean;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.pluginPath = void 0;
const fs_1 = require("fs");

@@ -7,2 +8,3 @@ const path_1 = require("path");

const babel_import_util_1 = require("babel-import-util");
exports.pluginPath = __filename;
function setComponentTemplate(target, state) {

@@ -21,3 +23,3 @@ return state.adder.import(target, '@ember/component', 'setComponentTemplate');

if (state.opts.packageGuard) {
let owningPackage = _1.PackageCache.shared('embroider-stage3', state.opts.appRoot).ownerOfFile(filename);
let owningPackage = _1.PackageCache.shared('embroider', state.opts.appRoot).ownerOfFile(filename);
if (!owningPackage || !owningPackage.isV2Ember() || !owningPackage.meta['auto-upgraded']) {

@@ -24,0 +26,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

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