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

@embroider/core

Package Overview
Dependencies
Maintainers
1
Versions
486
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@embroider/core - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

src/options.d.ts

2

package.json
{
"name": "@embroider/core",
"version": "0.0.6",
"version": "0.0.7",
"description": "A build system for EmberJS applications.",

@@ -5,0 +5,0 @@ "main": "src/index.js",

import { OutputPaths } from './wait-for-trees';
import Package from './package';
import { Asset } from './asset';
import Options from './options';
export declare type EmberENV = unknown;

@@ -27,4 +28,5 @@ export interface AppAdapter<TreeNames> {

private adapter;
private options;
private assets;
constructor(root: string, app: Package, adapter: AppAdapter<TreeNames>);
constructor(root: string, app: Package, adapter: AppAdapter<TreeNames>, options: Required<Options>);
private readonly activeAddonDescendants;

@@ -31,0 +33,0 @@ private scriptPriority;

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

const js_handlebars_1 = require("./js-handlebars");
const sortBy_1 = __importDefault(require("lodash/sortBy"));
const resolve_1 = __importDefault(require("resolve"));

@@ -21,5 +20,7 @@ const typescript_memoize_1 = require("typescript-memoize");

const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
const flatMap_1 = __importDefault(require("lodash/flatMap"));
const sortBy_1 = __importDefault(require("lodash/sortBy"));
const flatten_1 = __importDefault(require("lodash/flatten"));
const app_differ_1 = __importDefault(require("./app-differ"));
const ember_html_1 = require("./ember-html");
const flatMap_1 = __importDefault(require("lodash/flatMap"));
const assert_never_1 = __importDefault(require("assert-never"));

@@ -56,7 +57,38 @@ const fast_sourcemap_concat_1 = __importDefault(require("fast-sourcemap-concat"));

}
class AppFiles {
constructor(relativePaths) {
let tests = [];
let components = [];
let helpers = [];
let otherAppFiles = [];
for (let relativePath of relativePaths) {
if (relativePath.startsWith("tests/") && relativePath.endsWith('-test.js')) {
tests.push(relativePath);
continue;
}
if (!relativePath.startsWith('tests/') && (relativePath.endsWith('.js') || relativePath.endsWith('.hbs'))) {
if (relativePath.startsWith('components/') || relativePath.startsWith('templates/components')) {
components.push(relativePath);
}
else if (relativePath.startsWith('helpers/')) {
helpers.push(relativePath);
}
else {
otherAppFiles.push(relativePath);
}
continue;
}
}
this.tests = tests;
this.components = components;
this.helpers = helpers;
this.otherAppFiles = otherAppFiles;
}
}
class AppBuilder {
constructor(root, app, adapter) {
constructor(root, app, adapter, options) {
this.root = root;
this.app = app;
this.adapter = adapter;
this.options = options;
// for each relativePath, an Asset we have already emitted

@@ -185,3 +217,3 @@ this.assets = new Map();

this.appDiffer.update();
return this.appDiffer.files;
return new AppFiles(this.appDiffer.files);
}

@@ -398,12 +430,16 @@ prepareAsset(asset, appFiles, prepared, emberENV) {

let modulePrefix = this.adapter.modulePrefix();
// for the app tree, we take everything
let lazyModules = [...appFiles].map(relativePath => {
if (!relativePath.startsWith('tests/') && (relativePath.endsWith('.js') || relativePath.endsWith('.hbs'))) {
let noJS = relativePath.replace(/\.js$/, "");
let noHBS = noJS.replace(/\.hbs$/, "");
return {
runtime: `${modulePrefix}/${noHBS}`,
buildtime: `../${noJS}`,
};
}
let requiredAppFiles = [appFiles.otherAppFiles];
if (!this.options.staticComponents) {
requiredAppFiles.push(appFiles.components);
}
if (!this.options.staticHelpers) {
requiredAppFiles.push(appFiles.helpers);
}
let lazyModules = flatten_1.default(requiredAppFiles).map(relativePath => {
let noJS = relativePath.replace(/\.js$/, "");
let noHBS = noJS.replace(/\.hbs$/, "");
return {
runtime: `${modulePrefix}/${noHBS}`,
buildtime: `../${noJS}`,
};
}).filter(Boolean);

@@ -432,6 +468,4 @@ // for the src tree, we can limit ourselves to only known resolvable

const myName = 'assets/test.js';
let testModules = [...appFiles].map(relativePath => {
if (relativePath.startsWith("tests/") && relativePath.endsWith('-test.js')) {
return `../${relativePath}`;
}
let testModules = appFiles.tests.map(relativePath => {
return `../${relativePath}`;
}).filter(Boolean);

@@ -438,0 +472,0 @@ // tests necessarily also include the app. This is where we account for

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

import Package from './package';
import sortBy from 'lodash/sortBy';
import resolve from 'resolve';

@@ -13,8 +12,11 @@ import { Memoize } from "typescript-memoize";

import cloneDeep from 'lodash/cloneDeep';
import flatMap from 'lodash/flatMap';
import sortBy from 'lodash/sortBy';
import flatten from 'lodash/flatten';
import AppDiffer from './app-differ';
import { PreparedEmberHTML } from './ember-html';
import { Asset, EmberAsset, InMemoryAsset, OnDiskAsset, ImplicitAssetPaths } from './asset';
import flatMap from 'lodash/flatMap';
import assertNever from 'assert-never';
import SourceMapConcat from 'fast-sourcemap-concat';
import Options from './options';

@@ -132,2 +134,36 @@ export type EmberENV = unknown;

class AppFiles {
readonly tests: ReadonlyArray<string>;
readonly components: ReadonlyArray<string>;
readonly helpers: ReadonlyArray<string>;
readonly otherAppFiles: ReadonlyArray<string>;
constructor(relativePaths: Set<string>) {
let tests: string[] = [];
let components: string[] = [];
let helpers: string[] = [];
let otherAppFiles: string[] = [];
for (let relativePath of relativePaths) {
if (relativePath.startsWith("tests/") && relativePath.endsWith('-test.js')) {
tests.push(relativePath);
continue;
}
if (!relativePath.startsWith('tests/') && (relativePath.endsWith('.js') || relativePath.endsWith('.hbs'))) {
if (relativePath.startsWith('components/') || relativePath.startsWith('templates/components')) {
components.push(relativePath);
} else if (relativePath.startsWith('helpers/')) {
helpers.push(relativePath);
} else {
otherAppFiles.push(relativePath);
}
continue;
}
}
this.tests = tests;
this.components = components;
this.helpers = helpers;
this.otherAppFiles = otherAppFiles;
}
}
export class AppBuilder<TreeNames> {

@@ -140,3 +176,4 @@ // for each relativePath, an Asset we have already emitted

private app: Package,
private adapter: AppAdapter<TreeNames>
private adapter: AppAdapter<TreeNames>,
private options: Required<Options>
) {}

@@ -224,3 +261,3 @@

private appJSAsset(appFiles: Set<string>, prepared: Map<string, InternalAsset>): InternalAsset {
private appJSAsset(appFiles: AppFiles, prepared: Map<string, InternalAsset>): InternalAsset {
let appJS = prepared.get(`assets/${this.app.name}.js`);

@@ -234,3 +271,3 @@ if (!appJS) {

private insertEmberApp(asset: ParsedEmberAsset, appFiles: Set<string>, prepared: Map<string, InternalAsset>, emberENV: EmberENV) {
private insertEmberApp(asset: ParsedEmberAsset, appFiles: AppFiles, prepared: Map<string, InternalAsset>, emberENV: EmberENV) {
let html = asset.html;

@@ -287,3 +324,3 @@

private updateAppJS(appJSPath: string): Set<string> {
private updateAppJS(appJSPath: string): AppFiles {
if (!this.appDiffer) {

@@ -293,6 +330,6 @@ this.appDiffer = new AppDiffer(this.root, appJSPath, this.activeAddonDescendants);

this.appDiffer.update();
return this.appDiffer.files;
return new AppFiles(this.appDiffer.files);
}
private prepareAsset(asset: Asset, appFiles: Set<string>, prepared: Map<string, InternalAsset>, emberENV: EmberENV) {
private prepareAsset(asset: Asset, appFiles: AppFiles, prepared: Map<string, InternalAsset>, emberENV: EmberENV) {
if (asset.kind === 'ember') {

@@ -315,3 +352,3 @@ let prior = this.assets.get(asset.relativePath);

private prepareAssets(requestedAssets: Asset[], appFiles: Set<string>, emberENV: EmberENV): Map<string, InternalAsset> {
private prepareAssets(requestedAssets: Asset[], appFiles: AppFiles, emberENV: EmberENV): Map<string, InternalAsset> {
let prepared: Map<string, InternalAsset> = new Map();

@@ -388,3 +425,3 @@ for (let asset of requestedAssets) {

private async updateAssets(requestedAssets: Asset[], appFiles: Set<string>, emberENV: EmberENV) {
private async updateAssets(requestedAssets: Asset[], appFiles: AppFiles, emberENV: EmberENV) {
let assets = this.prepareAssets(requestedAssets, appFiles, emberENV);

@@ -536,14 +573,20 @@ for (let asset of assets.values()) {

private javascriptEntrypoint(name: string, appFiles: Set<string>): InternalAsset {
private javascriptEntrypoint(name: string, appFiles: AppFiles): InternalAsset {
let modulePrefix = this.adapter.modulePrefix();
// for the app tree, we take everything
let lazyModules = [...appFiles].map(relativePath => {
if (!relativePath.startsWith('tests/') && (relativePath.endsWith('.js') || relativePath.endsWith('.hbs'))) {
let noJS = relativePath.replace(/\.js$/, "");
let noHBS = noJS.replace(/\.hbs$/, "");
return {
runtime: `${modulePrefix}/${noHBS}`,
buildtime: `../${noJS}`,
};
}
let requiredAppFiles = [appFiles.otherAppFiles];
if (!this.options.staticComponents) {
requiredAppFiles.push(appFiles.components);
}
if(!this.options.staticHelpers) {
requiredAppFiles.push(appFiles.helpers);
}
let lazyModules = flatten(requiredAppFiles).map(relativePath => {
let noJS = relativePath.replace(/\.js$/, "");
let noHBS = noJS.replace(/\.hbs$/, "");
return {
runtime: `${modulePrefix}/${noHBS}`,
buildtime: `../${noJS}`,
};
}).filter(Boolean) as { runtime: string, buildtime: string }[];

@@ -576,8 +619,6 @@

private testJSEntrypoint(appFiles: Set<string>, prepared: Map<string, InternalAsset>): InternalAsset {
private testJSEntrypoint(appFiles: AppFiles, prepared: Map<string, InternalAsset>): InternalAsset {
const myName = 'assets/test.js';
let testModules = [...appFiles].map(relativePath => {
if (relativePath.startsWith("tests/") && relativePath.endsWith('-test.js')) {
return `../${relativePath}`;
}
let testModules = appFiles.tests.map(relativePath => {
return `../${relativePath}`;
}).filter(Boolean) as string[];

@@ -584,0 +625,0 @@

export { Packager, PackagerInstance } from './packager';
export { Resolver, ResolverInstance, Resolution } from './resolver';
export { AppMeta, AddonMeta } from './metadata';

@@ -8,2 +9,3 @@ export { default as Package } from './package';

export { Asset, EmberAsset, ImplicitAssetPaths } from './asset';
export { default as Options, optionsWithDefaults } from './options';
export { default as toBroccoliPlugin } from './to-broccoli-plugin';

@@ -10,0 +12,0 @@ export { default as PrebuiltAddons } from './prebuilt-addons';

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

exports.AppBuilder = app_1.AppBuilder;
var options_1 = require("./options");
exports.optionsWithDefaults = options_1.optionsWithDefaults;
// Shared utilities

@@ -9,0 +11,0 @@ var to_broccoli_plugin_1 = require("./to-broccoli-plugin");

// Shared interfaces
export { Packager, PackagerInstance } from './packager';
export { Resolver, ResolverInstance, Resolution } from './resolver';
export { AppMeta, AddonMeta } from './metadata';

@@ -9,2 +10,3 @@ export { default as Package } from './package';

export { Asset, EmberAsset, ImplicitAssetPaths } from './asset';
export { default as Options, optionsWithDefaults } from './options';

@@ -11,0 +13,0 @@ // Shared utilities

@@ -5,2 +5,5 @@ import makeDebug from 'debug';

declare const debug: makeDebug.IDebugger;
export { todo, unsupported, debug };
declare function realWarn(message: string, ...params: any[]): void;
export declare function expectWarning(pattern: RegExp, fn: () => void): boolean;
declare let warn: typeof realWarn;
export { todo, unsupported, warn, debug };

@@ -7,8 +7,43 @@ "use strict";

const debug_1 = __importDefault(require("debug"));
const todo = debug_1.default('embroider:core:todo');
const util_1 = require("util");
const todo = debug_1.default('embroider:todo');
exports.todo = todo;
const unsupported = debug_1.default('embroider:core:unsupported');
const unsupported = debug_1.default('embroider:unsupported');
exports.unsupported = unsupported;
const debug = debug_1.default('embroider:core:debug');
const debug = debug_1.default('embroider:debug');
exports.debug = debug;
function realWarn(message, ...params) {
console.log('WARNING: ' + util_1.format(message, ...params));
}
let expectStack = [];
let handled = new WeakSet();
function expectedWarn(message, ...params) {
let formattedMessage = util_1.format(message, ...params);
for (let pattern of expectStack) {
if (pattern.test(formattedMessage)) {
handled.add(pattern);
return;
}
}
realWarn(message, ...params);
}
function expectWarning(pattern, fn) {
if (expectStack.length === 0) {
exports.warn = warn = expectedWarn;
}
expectStack.push(pattern);
try {
fn();
}
finally {
expectStack.pop();
if (expectStack.length === 0) {
exports.warn = warn = realWarn;
}
}
return handled.has(pattern);
}
exports.expectWarning = expectWarning;
let warn = realWarn;
exports.warn = warn;
//# sourceMappingURL=messages.js.map
import makeDebug from 'debug';
const todo = makeDebug('embroider:core:todo');
const unsupported = makeDebug('embroider:core:unsupported');
const debug = makeDebug('embroider:core:debug');
import { format } from 'util';
export { todo, unsupported, debug };
const todo = makeDebug('embroider:todo');
const unsupported = makeDebug('embroider:unsupported');
const debug = makeDebug('embroider:debug');
function realWarn(message: string, ...params: any[]) {
console.log('WARNING: ' + format(message, ...params));
}
let expectStack = [] as RegExp[];
let handled: WeakSet<RegExp> = new WeakSet();
function expectedWarn(message: string, ...params: any[]) {
let formattedMessage = format(message, ...params);
for (let pattern of expectStack) {
if (pattern.test(formattedMessage)) {
handled.add(pattern);
return;
}
}
realWarn(message, ...params);
}
export function expectWarning(pattern: RegExp, fn: () => void) {
if (expectStack.length === 0) {
warn = expectedWarn;
}
expectStack.push(pattern);
try {
fn();
} finally {
expectStack.pop();
if (expectStack.length === 0) {
warn = realWarn;
}
}
return handled.has(pattern);
}
let warn = realWarn;
export { todo, unsupported, warn, debug };

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

abstract readonly dependencies: Package[];
readonly name: any;
readonly name: string;
readonly version: string;
readonly packageJSON: any;

@@ -9,0 +10,0 @@ readonly meta: AddonMeta;

@@ -20,2 +20,5 @@ "use strict";

}
get version() {
return this.packageJSON.version;
}
get packageJSON() {

@@ -22,0 +25,0 @@ return JSON.parse(fs_1.readFileSync(path_1.join(this.root, 'package.json'), 'utf8'));

@@ -12,6 +12,10 @@ import { Memoize } from 'typescript-memoize';

get name() {
get name(): string {
return this.packageJSON.name;
}
get version(): string {
return this.packageJSON.version;
}
@Memoize()

@@ -18,0 +22,0 @@ get packageJSON() {

@@ -0,1 +1,2 @@

import { ResolverInstance, Resolution } from './resolver';
export interface Plugins {

@@ -9,2 +10,5 @@ [type: string]: unknown[];

}
export default function (compiler: Compiler, EmberENV: unknown, plugins: Plugins): (moduleName: string, contents: string) => string;
export default function setupCompiler(compiler: Compiler, resolver: ResolverInstance, EmberENV: unknown, plugins: Plugins): {
compile: (moduleName: string, contents: string) => string;
dependenciesOf: (moduleName: string) => Resolution[] | undefined;
};

@@ -7,6 +7,114 @@ "use strict";

const strip_bom_1 = __importDefault(require("strip-bom"));
function default_1(compiler, EmberENV, plugins) {
const messages_1 = require("./messages");
function inScope(scopeStack, name) {
for (let scope of scopeStack) {
if (scope.includes(name)) {
return true;
}
}
return false;
}
function handleComponentHelper(param, resolver, moduleName, deps) {
let resolution;
if (param.type === 'StringLiteral') {
resolution = resolver.resolveComponentHelper(param.value, true, moduleName);
}
else {
resolution = resolver.resolveComponentHelper(param.original, false, moduleName);
}
if (resolution) {
deps.push(resolution);
}
}
function makeResolverTransform(resolver, dependencies) {
return function resolverTransform(env) {
let deps = [];
dependencies.set(env.moduleName, deps);
let scopeStack = [];
return {
name: 'embroider-build-time-resolver',
visitor: {
Program: {
enter(node) {
if (node.blockParams.length > 0) {
scopeStack.push(node.blockParams);
}
},
exit(node) {
if (node.blockParams.length > 0) {
scopeStack.pop();
}
}
},
BlockStatement(node) {
if (inScope(scopeStack, node.path.parts[0])) {
return;
}
if (node.path.original === 'component' && node.params.length > 0) {
return handleComponentHelper(node.params[0], resolver, env.moduleName, deps);
}
// a block counts as args from our perpsective (it's enough to prove
// this thing must be a component, not content)
let hasArgs = true;
let resolution = resolver.resolveMustache(node.path.original, hasArgs, env.moduleName);
if (resolution) {
deps.push(resolution);
}
},
SubExpression(node) {
if (inScope(scopeStack, node.path.parts[0])) {
return;
}
if (node.path.original === 'component' && node.params.length > 0) {
return handleComponentHelper(node.params[0], resolver, env.moduleName, deps);
}
let resolution = resolver.resolveSubExpression(node.path.original, env.moduleName);
if (resolution) {
deps.push(resolution);
}
},
MustacheStatement(node) {
if (inScope(scopeStack, node.path.parts[0])) {
return;
}
if (node.path.original === 'component' && node.params.length > 0) {
return handleComponentHelper(node.params[0], resolver, env.moduleName, deps);
}
let hasArgs = node.params.length > 0 || node.hash.pairs.length > 0;
let resolution = resolver.resolveMustache(node.path.original, hasArgs, env.moduleName);
if (resolution) {
deps.push(resolution);
}
},
ElementNode: {
enter(node) {
if (!inScope(scopeStack, node.tag.split('.')[0])) {
let resolution = resolver.resolveElement(node.tag, env.moduleName);
if (resolution) {
deps.push(resolution);
}
}
if (node.blockParams.length > 0) {
scopeStack.push(node.blockParams);
}
},
exit(node) {
if (node.blockParams.length > 0) {
scopeStack.pop();
}
}
}
}
};
};
}
function setupCompiler(compiler, resolver, EmberENV, plugins) {
let dependencies = new Map();
registerPlugins(compiler, plugins);
compiler.registerPlugin('ast', makeResolverTransform(resolver, dependencies));
initializeEmberENV(compiler, EmberENV);
return function (moduleName, contents) {
function dependenciesOf(moduleName) {
return dependencies.get(moduleName);
}
function compile(moduleName, contents) {
let compiled = compiler.precompile(strip_bom_1.default(contents), {

@@ -16,6 +124,29 @@ contents,

});
return 'export default Ember.HTMLBars.template(' + compiled + ');';
};
let lines = [];
let deps = dependenciesOf(moduleName);
if (deps) {
let counter = 0;
for (let dep of deps) {
if (dep.type === 'error') {
if (dep.hardFail) {
throw new Error(dep.message);
}
else {
messages_1.warn(dep.message);
}
}
else {
for (let { runtimeName, path } of dep.modules) {
lines.push(`import a${counter} from "${path}";`);
lines.push(`window.define('${runtimeName}', function(){ return a${counter++}});`);
}
}
}
}
lines.push(`export default Ember.HTMLBars.template(${compiled});`);
return lines.join("\n");
}
return { compile, dependenciesOf };
}
exports.default = default_1;
exports.default = setupCompiler;
function registerPlugins(compiler, plugins) {

@@ -22,0 +153,0 @@ for (let type in plugins) {

import stripBom from 'strip-bom';
import { ResolverInstance, Resolution } from './resolver';
import { warn } from './messages';

@@ -13,6 +15,121 @@ export interface Plugins {

export default function(compiler: Compiler, EmberENV: unknown, plugins: Plugins) {
function inScope(scopeStack: string[][], name: string) {
for (let scope of scopeStack) {
if (scope.includes(name)) {
return true;
}
}
return false;
}
function handleComponentHelper(param: any, resolver: ResolverInstance, moduleName: string, deps: Resolution[]) {
let resolution;
if (param.type === 'StringLiteral') {
resolution = resolver.resolveComponentHelper(param.value, true, moduleName);
} else {
resolution = resolver.resolveComponentHelper(param.original, false, moduleName);
}
if (resolution) {
deps.push(resolution);
}
}
function makeResolverTransform(resolver: ResolverInstance, dependencies: Map<string, Resolution[]>) {
return function resolverTransform(env: { moduleName: string }) {
let deps: Resolution[] = [];
dependencies.set(env.moduleName, deps);
let scopeStack: string[][] = [];
return {
name: 'embroider-build-time-resolver',
visitor: {
Program: {
enter(node: any) {
if (node.blockParams.length > 0) {
scopeStack.push(node.blockParams);
}
},
exit(node: any) {
if (node.blockParams.length > 0) {
scopeStack.pop();
}
}
},
BlockStatement(node: any) {
if (inScope(scopeStack, node.path.parts[0])) {
return;
}
if (node.path.original === 'component' && node.params.length > 0) {
return handleComponentHelper(node.params[0], resolver, env.moduleName, deps);
}
// a block counts as args from our perpsective (it's enough to prove
// this thing must be a component, not content)
let hasArgs = true;
let resolution = resolver.resolveMustache(node.path.original, hasArgs, env.moduleName);
if (resolution) {
deps.push(resolution);
}
},
SubExpression(node: any) {
if (inScope(scopeStack, node.path.parts[0])) {
return;
}
if (node.path.original === 'component' && node.params.length > 0) {
return handleComponentHelper(node.params[0], resolver, env.moduleName, deps);
}
let resolution = resolver.resolveSubExpression(node.path.original, env.moduleName);
if (resolution) {
deps.push(resolution);
}
},
MustacheStatement(node: any) {
if (inScope(scopeStack, node.path.parts[0])) {
return;
}
if (node.path.original === 'component' && node.params.length > 0) {
return handleComponentHelper(node.params[0], resolver, env.moduleName, deps);
}
let hasArgs = node.params.length > 0 || node.hash.pairs.length > 0;
let resolution = resolver.resolveMustache(node.path.original, hasArgs, env.moduleName);
if (resolution) {
deps.push(resolution);
}
},
ElementNode: {
enter(node: any) {
if (!inScope(scopeStack, node.tag.split('.')[0])) {
let resolution = resolver.resolveElement(node.tag, env.moduleName);
if (resolution) {
deps.push(resolution);
}
}
if (node.blockParams.length > 0) {
scopeStack.push(node.blockParams);
}
},
exit(node: any) {
if (node.blockParams.length > 0) {
scopeStack.pop();
}
}
}
}
};
};
}
export default function setupCompiler(compiler: Compiler, resolver: ResolverInstance, EmberENV: unknown, plugins: Plugins) {
let dependencies: Map<string, Resolution[]> = new Map();
registerPlugins(compiler, plugins);
compiler.registerPlugin('ast', makeResolverTransform(resolver, dependencies));
initializeEmberENV(compiler, EmberENV);
return function(moduleName: string, contents: string) {
function dependenciesOf(moduleName: string): Resolution[] | undefined {
return dependencies.get(moduleName);
}
function compile(moduleName: string, contents: string) {
let compiled = compiler.precompile(

@@ -24,4 +141,25 @@ stripBom(contents), {

);
return 'export default Ember.HTMLBars.template('+compiled+');';
};
let lines: string[] = [];
let deps = dependenciesOf(moduleName);
if (deps) {
let counter = 0;
for (let dep of deps) {
if (dep.type === 'error') {
if (dep.hardFail) {
throw new Error(dep.message);
} else {
warn(dep.message);
}
} else {
for (let { runtimeName, path } of dep.modules) {
lines.push(`import a${counter} from "${path}";`);
lines.push(`window.define('${runtimeName}', function(){ return a${counter++}});`);
}
}
}
}
lines.push(`export default Ember.HTMLBars.template(${compiled});`);
return lines.join("\n");
}
return { compile, dependenciesOf };
}

@@ -28,0 +166,0 @@

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