🚀 Socket Launch Week 🚀 Day 5: Introducing Socket Fix.Learn More

@embroider/macros

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@embroider/macros - npm Package Compare versions

Comparing version

to
1.10.1-unstable.e891bf1

{
"name": "@embroider/macros",
"version": "1.10.1-unstable.e35628d",
"version": "1.10.1-unstable.e891bf1",
"private": false,

@@ -26,3 +26,3 @@ "description": "Standardized build-time macros for ember apps.",

"dependencies": {
"@embroider/shared-internals": "2.0.1-unstable.e35628d",
"@embroider/shared-internals": "2.0.1-unstable.e891bf1",
"assert-never": "^1.2.1",

@@ -40,7 +40,10 @@ "babel-import-util": "^1.1.0",

"@babel/traverse": "^7.14.5",
"@embroider/core": "2.1.2-unstable.e35628d",
"@embroider/test-support": "0.36.0",
"@embroider/core": "2.1.2-unstable.e891bf1",
"@embroider/test-support": "workspace:*",
"@glint/template": "^1.0.0",
"@types/babel__core": "^7.1.14",
"@types/babel__generator": "^7.6.2",
"@types/babel__template": "^7.4.0",
"@types/babel__traverse": "^7.18.5",
"@types/lodash": "^4.14.170",
"@types/node": "^15.12.2",

@@ -51,5 +54,13 @@ "@types/resolve": "^1.20.0",

"code-equality-assertions": "^0.9.0",
"scenario-tester": "^2.0.1",
"typescript": "*"
"scenario-tester": "^2.1.2",
"typescript": "^4.9.0"
},
"peerDependencies": {
"@glint/template": "^1.0.0"
},
"peerDependenciesMeta": {
"@glint/template": {
"optional": true
}
},
"engines": {

@@ -56,0 +67,0 @@ "node": "12.* || 14.* || >= 16"

@@ -9,3 +9,3 @@ # @embroider/macros

The [Embroider package spec](../../SPEC.md) proposes fixing this by making Ember addons much more static. But they will still need the ability to change themselves in certain ways at app compilation time. Hence this package.
The [Embroider package spec](../../docs/spec.md) proposes fixing this by making Ember addons much more static. But they will still need the ability to change themselves in certain ways at app compilation time. Hence this package.

@@ -220,3 +220,3 @@ This package works in both Embroider and Classical builds, so that addon authors can switch to this newer pattern without disruption.

```ts
import type { EmbroiderMacrosRegistry } from "@embroider/macros/src/template-registry";
import type { EmbroiderMacrosRegistry } from "@embroider/macros";
```

@@ -223,0 +223,0 @@ to your app's e.g. `types/glint.d.ts` file, and making sure your registry extends from EmbroiderMacrosRegistry:

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

import type * as Babel from '@babel/core';
declare type CallEachExpression = NodePath<t.CallExpression> & {
type CallEachExpression = NodePath<t.CallExpression> & {
get(callee: 'callee'): NodePath<t.Identifier>;
};
export declare type EachPath = NodePath<t.ForOfStatement> & {
export type EachPath = NodePath<t.ForOfStatement> & {
get(right: 'right'): CallEachExpression;

@@ -11,0 +11,0 @@ };

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

}
export declare type EvaluateResult = ConfidentResult | UnknownResult;
export type EvaluateResult = ConfidentResult | UnknownResult;
export interface EvaluationEnv {

@@ -15,0 +15,0 @@ knownPaths?: Map<NodePath, EvaluateResult>;

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

import type { types as t } from '@babel/core';
export declare type Mode = 'own' | 'getGlobalConfig' | 'package';
export type Mode = 'own' | 'getGlobalConfig' | 'package';
export default function getConfig(path: NodePath<t.CallExpression>, state: State, mode: Mode): unknown;
export declare function insertConfig(path: NodePath<t.CallExpression>, state: State, mode: Mode, context: typeof Babel): void;
export declare function inlineRuntimeConfig(path: NodePath<t.FunctionDeclaration>, state: State, context: typeof Babel): void;
import type { NodePath } from '@babel/traverse';
import type { types as t } from '@babel/core';
import State from './state';
export declare type MacroConditionPath = NodePath<t.IfStatement | t.ConditionalExpression> & {
export type MacroConditionPath = NodePath<t.IfStatement | t.ConditionalExpression> & {
get(test: 'test'): NodePath<t.CallExpression> & {

@@ -6,0 +6,0 @@ get(callee: 'callee'): NodePath<t.Identifier>;

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k;

@@ -12,1 +12,40 @@ export declare function dependencySatisfies(packageName: string, semverRange: string): boolean;

export declare function moduleExists(packageName: string): boolean;
import type { HelperLike } from '@glint/template';
export interface EmbroiderMacrosRegistry {
macroGetOwnConfig: HelperLike<{
Args: {
Positional: [...keys: string[]];
};
Return: ReturnType<typeof getOwnConfig>;
}>;
macroGetConfig: HelperLike<{
Args: {
Positional: [packageName: string, ...keys: string[]];
};
Return: ReturnType<typeof getConfig>;
}>;
macroCondition: HelperLike<{
Args: {
Positional: [predicate: boolean];
};
Return: boolean;
}>;
macroDependencySatisfies: HelperLike<{
Args: {
Positional: Parameters<typeof dependencySatisfies>;
};
Return: ReturnType<typeof dependencySatisfies>;
}>;
macroMaybeAttrs: HelperLike<{
Args: {
Positional: [predicate: boolean, ...bareAttrs: unknown[]];
};
Return: void;
}>;
macroFailBuild: HelperLike<{
Args: {
Positional: Parameters<typeof failBuild>;
};
Return: ReturnType<typeof failBuild>;
}>;
}
import type { PluginItem } from '@babel/core';
import { FirstTransformParams } from './glimmer/ast-transform';
export declare type SourceOfConfig = (config: object) => {
export type SourceOfConfig = (config: object) => {
readonly name: string;

@@ -8,3 +8,3 @@ readonly root: string;

};
export declare type Merger = (configs: object[], params: {
export type Merger = (configs: object[], params: {
sourceOfConfig: SourceOfConfig;

@@ -11,0 +11,0 @@ }) => object;

@@ -45,31 +45,2 @@ "use strict";

class MacrosConfig {
constructor(origAppRoot) {
this.origAppRoot = origAppRoot;
this.mode = 'compile-time';
this.globalConfig = {};
this.isDevelopingPackageRoots = new Set();
this._importSyncImplementation = 'cjs';
this._configWritable = true;
this.configs = new Map();
this.configSources = new WeakMap();
this.mergers = new Map();
this.moves = new Map();
// this uses globalConfig because these things truly are global. Even if a
// package doesn't have a dep or peerDep on @embroider/macros, it's legit
// for them to want to know the answer to these questions, and there is only
// one answer throughout the whole dependency graph.
this.globalConfig['@embroider/macros'] = {
// this powers the `isTesting` macro. It always starts out false here,
// because:
// - if this is a production build, we will evaluate all macros at build
// time and isTesting will stay false, so test-only code will not be
// included.
// - if this is a dev build, we evaluate macros at runtime, which allows
// both "I'm running my app in development" and "I'm running my test
// suite" to coexist within a single build. When you run the test
// suite, early in the runtime boot process we can flip isTesting to
// true to distinguish the two.
isTesting: false,
};
}
static for(key, appRoot) {

@@ -132,2 +103,31 @@ let found = localSharedState.get(key);

}
constructor(origAppRoot) {
this.origAppRoot = origAppRoot;
this.mode = 'compile-time';
this.globalConfig = {};
this.isDevelopingPackageRoots = new Set();
this._importSyncImplementation = 'cjs';
this._configWritable = true;
this.configs = new Map();
this.configSources = new WeakMap();
this.mergers = new Map();
this.moves = new Map();
// this uses globalConfig because these things truly are global. Even if a
// package doesn't have a dep or peerDep on @embroider/macros, it's legit
// for them to want to know the answer to these questions, and there is only
// one answer throughout the whole dependency graph.
this.globalConfig['@embroider/macros'] = {
// this powers the `isTesting` macro. It always starts out false here,
// because:
// - if this is a production build, we will evaluate all macros at build
// time and isTesting will stay false, so test-only code will not be
// included.
// - if this is a dev build, we evaluate macros at runtime, which allows
// both "I'm running my app in development" and "I'm running my test
// suite" to coexist within a single build. When you run the test
// suite, early in the runtime boot process we can flip isTesting to
// true to distinguish the two.
isTesting: false,
};
}
get packageCache() {

@@ -134,0 +134,0 @@ return shared_internals_1.PackageCache.shared('embroider-macros', this.origAppRoot);

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