ember-css-modules 1.6.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const Funnel = require('broccoli-funnel');
3
+ const { Funnel } = require('broccoli-funnel');
4
4
  const MergeTrees = require('broccoli-merge-trees');
5
5
  const Bridge = require('broccoli-bridge');
6
6
  const ensurePosixPath = require('ensure-posix-path');
@@ -31,35 +31,37 @@ module.exports = class ModulesPreprocessor {
31
31
  }
32
32
 
33
33
  toTree(inputTree, path) {
34
- if (path !== '/') { return inputTree; }
34
+ if (path !== '/') {
35
+ return inputTree;
36
+ }
35
37
 
36
- let merged = new MergeTrees([inputTree, this.buildModulesTree(inputTree)], { overwrite: true });
38
+ let merged = new MergeTrees([inputTree, this.buildModulesTree(inputTree)], {
39
+ overwrite: true,
40
+ });
37
41
 
38
42
  // Exclude the individual CSS files – those will be concatenated into the styles tree later
39
- return new Funnel(merged, { exclude: ['**/*.' + this.owner.getFileExtension()] });
43
+ return new Funnel(merged, {
44
+ exclude: ['**/*.' + this.owner.getFileExtension()],
45
+ });
40
46
  }
41
47
 
42
48
  buildModulesTree(modulesInput) {
43
49
  if (!this._modulesTree) {
44
- let inputRoot = this.owner.belongsToAddon() ? this.owner.getParentAddonTree() : this.owner.app.trees.app;
45
- let outputRoot = (this.owner.belongsToAddon() ? this.owner.getAddonModulesRoot() : '');
46
-
47
- if (outputRoot) {
48
- inputRoot = new Funnel(inputRoot, {
49
- destDir: outputRoot,
50
- });
51
- }
50
+ let inputRoot = this.owner.belongsToAddon()
51
+ ? this.owner.getParentAddonTree()
52
+ : this.owner.app.trees.app;
52
53
 
53
54
  // If moduleName is defined, that should override the parent's name.
54
55
  // Otherwise, the template and generated module will disagree as to what the path should be.
55
56
  let ownerParent = this.owner.getParent();
56
57
  this._parentName = this.owner.getParentName();
57
- let ownerName = ownerParent.moduleName ? ownerParent.moduleName() : this._parentName;
58
+ let ownerName = ownerParent.moduleName
59
+ ? ownerParent.moduleName()
60
+ : this._parentName;
58
61
  this._ownerName = ownerName;
59
62
 
60
63
  let modulesSources = new ModuleSourceFunnel(inputRoot, modulesInput, {
61
64
  include: ['**/*.' + this.owner.getFileExtension()],
62
- outputRoot,
63
65
  parentName: ownerName,
64
66
  });
65
67
 
@@ -67,12 +69,12 @@ module.exports = class ModulesPreprocessor {
67
69
  extension: this.owner.getFileExtension(),
68
70
  plugins: this.getPostcssPlugins(),
69
71
  enableSourceMaps: this.owner.enableSourceMaps(),
70
- sourceMapBaseDir: this.owner.belongsToAddon() ? this.owner.getAddonModulesRoot() : '',
72
+ sourceMapBaseDir: '',
71
73
  postcssOptions: this.owner.getPostcssOptions(),
72
74
  virtualModules: this.owner.getVirtualModules(),
73
75
  generateScopedName: this.scopedNameGenerator(),
74
76
  resolvePath: this.resolveAndRecordPath.bind(this),
75
- getJSFilePath: cssPath => this.getJSFilePath(cssPath, modulesSources),
77
+ getJSFilePath: (cssPath) => this.getJSFilePath(cssPath, modulesSources),
76
78
  onBuildStart: () => this.owner.notifyPlugins('buildStart'),
77
79
  onBuildEnd: () => this.owner.notifyPlugins('buildEnd'),
78
80
  onBuildSuccess: () => this.owner.notifyPlugins('buildSuccess'),
@@ -80,7 +82,7 @@ module.exports = class ModulesPreprocessor {
80
82
  onProcessFile: this.resetFileDependencies.bind(this),
81
83
  onModuleResolutionFailure: this.onModuleResolutionFailure.bind(this),
82
84
  onImportResolutionFailure: this.onImportResolutionFailure.bind(this),
83
- formatJS: formatJS
85
+ formatJS: formatJS,
84
86
  });
85
87
 
86
88
  this._modulesTree = modulesTree;
@@ -108,7 +110,10 @@ module.exports = class ModulesPreprocessor {
108
110
  }
109
111
 
110
112
  let extensionRegex = new RegExp(`\\.${this.owner.getFileExtension()}$`);
111
- let cssPathWithoutExtension = cssPathWithExtension.replace(extensionRegex, '');
113
+ let cssPathWithoutExtension = cssPathWithExtension.replace(
114
+ extensionRegex,
115
+ ''
116
+ );
112
117
 
113
118
  if (modulesSource.has(`${cssPathWithoutExtension}.hbs`)) {
114
119
  return `${cssPathWithExtension}.js`;
@@ -119,7 +124,7 @@ module.exports = class ModulesPreprocessor {
119
124
 
120
125
  scopedNameGenerator() {
121
126
  let generator = this.owner.getScopedNameGenerator();
122
- return function(className, modulePath, fullRule, dependency) {
127
+ return function (className, modulePath, fullRule, dependency) {
123
128
  let realPath = '/' + (dependency.keyPath || modulePath);
124
129
  return generator(className, realPath, fullRule);
125
130
  };
@@ -142,7 +147,7 @@ module.exports = class ModulesPreprocessor {
142
147
 
143
148
  this._plugins = {
144
149
  before: [this.rootPathPlugin()].concat(plugins.before || []),
145
- after: [this.dependenciesPlugin()].concat(plugins.after || [])
150
+ after: plugins.after || [],
146
151
  };
147
152
  }
148
153
 
@@ -150,7 +155,9 @@ module.exports = class ModulesPreprocessor {
150
155
  }
151
156
 
152
157
  onModuleResolutionFailure(failure, modulePath, fromFile) {
153
- throw new Error('Unable to locate module "' + modulePath + '" imported from ' + fromFile);
158
+ throw new Error(
159
+ 'Unable to locate module "' + modulePath + '" imported from ' + fromFile
160
+ );
154
161
  }
155
162
 
156
163
  onImportResolutionFailure(symbol, modulePath, fromFile) {
@@ -161,42 +168,34 @@ module.exports = class ModulesPreprocessor {
161
168
  absolutePath = this.resolvePath(modulePath, fromFile);
162
169
  }
163
170
 
164
- throw new Error(`No class or value named '${symbol}' was found in ${absolutePath}, imported from ${ fromFile}.`);
165
- }
166
-
167
- recordDependencies(fromFile, type, resolvedPaths) {
168
- debug('recording %s dependencies from %s to %o', type, fromFile, resolvedPaths);
169
- let deps = this.getDependencies();
170
- let fileDeps = deps[fromFile] || (deps[fromFile] = {});
171
- fileDeps[type] = (fileDeps[type] || []).concat(resolvedPaths);
171
+ throw new Error(
172
+ `No class or value named '${symbol}' was found in ${absolutePath}, imported from ${fromFile}.`
173
+ );
172
174
  }
173
175
 
174
176
  // Records dependencies from `composes` and `@value` imports
175
177
  resolveAndRecordPath(importPath, fromFile) {
176
- let resolved = this.resolvePath(importPath, fromFile);
177
- this.recordDependencies(fromFile, 'implicit', [resolved]);
178
- return resolved;
179
- }
178
+ let resolvedPath = this.resolvePath(importPath, fromFile);
179
+ let allDependencies = this.getDependencies();
180
+ let fileDependencies =
181
+ allDependencies[fromFile] || (allDependencies[fromFile] = []);
180
182
 
181
- // Records explicit `@after-module` dependency declarations
182
- dependenciesPlugin() {
183
- let recordDependencies = this.recordDependencies.bind(this);
184
- let resolve = this.resolvePath.bind(this);
185
- return require('./postcss-module-order-directive')({
186
- ui: this.owner.ui,
187
- emitDeprecationWarning: !this.owner.cssModulesOptions._silenceAfterModuleDeprecation,
188
- updateDependencies: function(fromFile, relativePaths) {
189
- recordDependencies(fromFile, 'explicit', relativePaths.map(function(relativePath) {
190
- return resolve(relativePath, fromFile);
191
- }));
192
- }
193
- });
183
+ debug('recording dependency from %s to %s', fromFile, resolvedPath);
184
+ fileDependencies.push(resolvedPath);
185
+
186
+ return resolvedPath;
194
187
  }
195
188
 
196
189
  rootPathPlugin() {
197
- return require('./make-postcss-plugin')('root-path-tag', () => (css) => {
198
- css.source.input.rootPath = this._modulesTree.inputPaths[0];
199
- });
190
+ return Object.assign(
191
+ () => ({
192
+ postcssPlugin: 'root-path-tag',
193
+ Once: (css) => {
194
+ css.source.input.rootPath = this._modulesTree.inputPaths[0];
195
+ },
196
+ }),
197
+ { postcss: true }
198
+ );
200
199
  }
201
200
 
202
201
  resolvePath(importPath, fromFile) {
@@ -206,10 +205,9 @@ module.exports = class ModulesPreprocessor {
206
205
  defaultExtension: this.owner.getFileExtension(),
207
206
  ownerName: this._ownerName,
208
207
  parentName: this._parentName,
209
- addonModulesRoot: this.owner.getAddonModulesRoot(),
210
208
  root: ensurePosixPath(this._modulesTree.inputPaths[0]),
211
209
  parent: this.owner.getParent(),
212
- ui: this.owner.ui
210
+ ui: this.owner.ui,
213
211
  });
214
212
  }
215
213
  };
@@ -223,23 +221,28 @@ function formatJS(classMapping) {
223
221
 
224
222
  class ModuleSourceFunnel extends Funnel {
225
223
  constructor(input, stylesTree, options) {
226
- super(input, options);
227
- this.stylesTree = stylesTree;
224
+ super([input, stylesTree], options);
228
225
  this.parentName = options.parentName;
229
- this.destDir = options.outputRoot;
230
226
  this.inputHasParentName = null;
231
227
  }
232
228
 
233
229
  has(filePath) {
234
- let relativePath = this.inputHasParentName ? filePath : filePath.replace(`${this.parentName}/`, '');
230
+ let relativePath = this.inputHasParentName
231
+ ? filePath
232
+ : filePath.replace(`${this.parentName}/`, '');
235
233
  return fs.existsSync(`${this.inputPaths[0]}/${relativePath}`);
236
234
  }
237
235
 
238
236
  build() {
239
237
  if (this.inputHasParentName === null) {
240
- this.inputHasParentName = fs.existsSync(`${this.inputPaths[0]}/${this.parentName}`);
241
-
242
- let stylesTreeHasParentName = fs.existsSync(`${this.stylesTree.outputPath}/${this.parentName}`);
238
+ this.inputHasParentName = fs.existsSync(
239
+ `${this.inputPaths[0]}/${this.parentName}`
240
+ );
241
+
242
+ let stylesTreePath = this.inputPaths[1];
243
+ let stylesTreeHasParentName = fs.existsSync(
244
+ `${stylesTreePath}/${this.parentName}`
245
+ );
243
246
  if (stylesTreeHasParentName && !this.inputHasParentName) {
244
247
  this.destDir += `/${this.parentName}`;
245
248
  }
@@ -4,7 +4,7 @@ const debug = require('debug')('ember-css-modules:output-styles-preprocessor');
4
4
  const Concat = require('broccoli-concat');
5
5
  const MergeTrees = require('broccoli-merge-trees');
6
6
  const PostCSS = require('broccoli-postcss');
7
- const Funnel = require('broccoli-funnel');
7
+ const { Funnel } = require('broccoli-funnel');
8
8
 
9
9
  module.exports = class OutputStylesPreprocessor {
10
10
  constructor(options) {
@@ -12,12 +12,14 @@ module.exports = class OutputStylesPreprocessor {
12
12
  }
13
13
 
14
14
  toTree(inputNode, inputPath, outputDirectory, options) {
15
- let outputFile = this.owner.getIntermediateOutputPath() || options.outputPaths[this.owner.belongsToAddon() ? 'addon' : 'app'];
15
+ let outputFile =
16
+ this.owner.getIntermediateOutputPath() ||
17
+ options.outputPaths[this.owner.belongsToAddon() ? 'addon' : 'app'];
16
18
  let concatOptions = {
17
19
  inputFiles: ['**/*.' + this.owner.getFileExtension()],
18
20
  outputFile: outputFile,
19
21
  allowNone: true,
20
- sourceMapConfig: this.sourceMapConfig()
22
+ sourceMapConfig: this.sourceMapConfig(),
21
23
  };
22
24
 
23
25
  debug('concatenating module stylesheets: %o', concatOptions);
@@ -32,7 +34,7 @@ module.exports = class OutputStylesPreprocessor {
32
34
 
33
35
  concat = new PostCSS(concat, {
34
36
  plugins: postprocessPlugins,
35
- exclude: ['**/*.map']
37
+ exclude: ['**/*.map'],
36
38
  });
37
39
  }
38
40
 
@@ -41,7 +43,9 @@ module.exports = class OutputStylesPreprocessor {
41
43
  if (this.owner.getIntermediateOutputPath()) {
42
44
  let passthroughExtensions = this.owner.getPassthroughFileExtensions();
43
45
  if (passthroughExtensions.length) {
44
- inputNode = new Funnel(inputNode, { include: passthroughExtensions.map(ext => `**/*.${ext}`) });
46
+ inputNode = new Funnel(inputNode, {
47
+ include: passthroughExtensions.map((ext) => `**/*.${ext}`),
48
+ });
45
49
  }
46
50
  return new MergeTrees([inputNode, concat], { overwrite: true });
47
51
  } else {
@@ -50,20 +54,27 @@ module.exports = class OutputStylesPreprocessor {
50
54
  }
51
55
 
52
56
  /*
53
- * A broccoli-concat tree that will dynamically order header files based on our @after-module directives.
57
+ * A broccoli-concat tree that will dynamically order header files based on dependencies
58
+ * between modules and declared header files.
54
59
  */
55
60
  dynamicHeaderConcat(options) {
56
61
  let modulesTree = this.owner.getModulesTree();
57
62
  let fixedHeaders = this.owner.getFixedModules('header');
58
63
  let fixedFooters = this.owner.getFixedModules('footer');
59
- let getHeaderFiles = this.getHeaderFiles.bind(this, new Set(fixedHeaders.concat(fixedFooters)));
64
+ let getDependentFiles = this.getDependentFiles.bind(
65
+ this,
66
+ new Set(fixedHeaders.concat(fixedFooters))
67
+ );
60
68
 
61
69
  let concat = new Concat(modulesTree, options);
62
70
  let build = concat.build;
63
- concat.build = function() {
71
+ concat.build = function () {
64
72
  this.footerFiles = fixedFooters;
65
- this.headerFiles = fixedHeaders.concat(getHeaderFiles());
66
- this._headerFooterFilesIndex = makeIndex(this.headerFiles, this.footerFiles);
73
+ this.headerFiles = fixedHeaders.concat(getDependentFiles());
74
+ this._headerFooterFilesIndex = makeIndex(
75
+ this.headerFiles,
76
+ this.footerFiles
77
+ );
67
78
  return build.apply(this, arguments);
68
79
  };
69
80
 
@@ -71,54 +82,27 @@ module.exports = class OutputStylesPreprocessor {
71
82
  }
72
83
 
73
84
  /*
74
- * Based on the @after-module directives in the source files, produces an ordered list of files that should be
75
- * boosted to the top of the concatenated output.
85
+ * Based on dependencies between modules, produce an ordered list of modules that
86
+ * should be boosted to the top of output, just below
76
87
  */
77
- getHeaderFiles(fixedModules) {
78
- let explicitDeps = this.explicitDependencies(fixedModules);
88
+ getDependentFiles(fixedModules) {
79
89
  let implicitDeps = this.implicitDependencies(fixedModules);
80
- let sorted = require('toposort')(explicitDeps.concat(implicitDeps));
90
+ let sorted = require('toposort')(implicitDeps);
81
91
  debug('sorted dependencies %o', sorted);
82
- return sorted.filter(file => !fixedModules.has(file));
83
- }
84
-
85
- // Dependencies due to explicit `@after-module` declarations
86
- explicitDependencies(fixedModules) {
87
- let edges = [];
88
-
89
- this.eachFileWithDependencies('explicit', function(file, deps) {
90
- let currentFile = file, dep;
91
-
92
- if (fixedModules.has(currentFile)) {
93
- throw new Error(`Configured headerFiles and footerFiles can't use @after-module`);
94
- }
95
-
96
- // For each file with explicit dependencies, create a chain of edges in the reverse order they appear in source
97
- for (let i = deps.length - 1; i >= 0; i--) {
98
- dep = deps[i];
99
-
100
- if (fixedModules.has(dep)) {
101
- throw new Error(`Configured headerFiles and footerFiles can't be the target of @after-module`);
102
- }
103
-
104
- edges.push([dep, currentFile]);
105
- currentFile = dep;
106
- }
107
- });
108
-
109
- debug('explicit dependencies: %o', edges);
110
- return edges;
92
+ return sorted.filter((file) => !fixedModules.has(file));
111
93
  }
112
94
 
113
95
  // Dependencies stemming from `composes:` and `@value` directives
114
96
  implicitDependencies(fixedModules) {
115
97
  let edges = [];
116
98
 
117
- this.eachFileWithDependencies('implicit', function(file, deps) {
99
+ this.eachFileWithDependencies(function (file, deps) {
118
100
  // headerFiles and footerFiles ignore implicit ordering constraints
119
- if (fixedModules.has(file)) { return; }
101
+ if (fixedModules.has(file)) {
102
+ return;
103
+ }
120
104
 
121
- deps.forEach(function(dep) {
105
+ deps.forEach(function (dep) {
122
106
  if (!fixedModules.has(dep)) {
123
107
  edges.push([dep, file]);
124
108
  }
@@ -129,19 +113,26 @@ module.exports = class OutputStylesPreprocessor {
129
113
  return edges;
130
114
  }
131
115
 
132
- eachFileWithDependencies(type, callback) {
116
+ eachFileWithDependencies(callback) {
133
117
  let depMap = this.owner.getModuleDependencies();
134
118
 
135
119
  Object.keys(depMap).forEach((file) => {
136
- let deps = depMap[file] && depMap[file][type];
137
- if (!deps || !deps.length) { return; }
120
+ let deps = depMap[file] && depMap[file];
121
+ if (!deps || !deps.length) {
122
+ return;
123
+ }
138
124
 
139
125
  let relativeFile = this.owner.getModuleRelativePath(file);
140
- callback(relativeFile, deps.filter(function(dep) {
141
- return dep.type === 'internal';
142
- }).map(function(dep) {
143
- return dep.keyPath;
144
- }));
126
+ callback(
127
+ relativeFile,
128
+ deps
129
+ .filter(function (dep) {
130
+ return dep.type === 'internal';
131
+ })
132
+ .map(function (dep) {
133
+ return dep.keyPath;
134
+ })
135
+ );
145
136
  });
146
137
  }
147
138
 
@@ -149,7 +140,7 @@ module.exports = class OutputStylesPreprocessor {
149
140
  if (this.owner.enableSourceMaps()) {
150
141
  return {
151
142
  extensions: ['css'],
152
- mapCommentType: 'block'
143
+ mapCommentType: 'block',
153
144
  };
154
145
  }
155
146
  }
@@ -159,7 +150,7 @@ module.exports = class OutputStylesPreprocessor {
159
150
  function makeIndex(a, b) {
160
151
  let index = Object.create(null);
161
152
 
162
- ((a || []).concat(b ||[])).forEach(function(a) {
153
+ (a || []).concat(b || []).forEach(function (a) {
163
154
  index[a] = true;
164
155
  });
165
156
 
@@ -38,13 +38,25 @@ module.exports = class PluginRegistry {
38
38
  }
39
39
 
40
40
  _instantiatePlugins() {
41
- let plugins = this._discoverPlugins(this.parent.addons, 'ember-css-modules-plugin');
41
+ let plugins = this._discoverPlugins(
42
+ this.parent.addons,
43
+ 'ember-css-modules-plugin'
44
+ );
42
45
 
43
46
  // For addons under development, crawl the host app's available plugins for linting tools so they can be devDependencies
44
- if (typeof this.parent.isDevelopingAddon === 'function' && this.parent.isDevelopingAddon()) {
45
- let parentAddonNames = new Set(this.parent.addons.map(addon => addon.name));
46
- let hostAddons = this.parent.project.addons.filter(addon => !parentAddonNames.has(addon.name));
47
- plugins = plugins.concat(this._discoverPlugins(hostAddons, 'ember-css-modules-lint-plugin'));
47
+ if (
48
+ typeof this.parent.isDevelopingAddon === 'function' &&
49
+ this.parent.isDevelopingAddon()
50
+ ) {
51
+ let parentAddonNames = new Set(
52
+ this.parent.addons.map((addon) => addon.name)
53
+ );
54
+ let hostAddons = this.parent.project.addons.filter(
55
+ (addon) => !parentAddonNames.has(addon.name)
56
+ );
57
+ plugins = plugins.concat(
58
+ this._discoverPlugins(hostAddons, 'ember-css-modules-lint-plugin')
59
+ );
48
60
  }
49
61
 
50
62
  return plugins;
@@ -52,14 +64,16 @@ module.exports = class PluginRegistry {
52
64
 
53
65
  _discoverPlugins(addons, keyword) {
54
66
  return addons
55
- .filter(addon => this._isPlugin(addon, keyword))
56
- .map(addon => this._instantiatePluginFor(addon));
67
+ .filter((addon) => this._isPlugin(addon, keyword))
68
+ .map((addon) => this._instantiatePluginFor(addon));
57
69
  }
58
70
 
59
71
  _isPlugin(addon, keyword) {
60
- return addon.pkg
61
- && addon.pkg.keywords
62
- && addon.pkg.keywords.indexOf(keyword) >= 0;
72
+ return (
73
+ addon.pkg &&
74
+ addon.pkg.keywords &&
75
+ addon.pkg.keywords.indexOf(keyword) >= 0
76
+ );
63
77
  }
64
78
 
65
79
  _instantiatePluginFor(addon) {
@@ -83,4 +97,4 @@ module.exports = class PluginRegistry {
83
97
  }
84
98
  return options;
85
99
  }
86
- }
100
+ };
@@ -4,24 +4,39 @@ const path = require('path');
4
4
  const ensurePosixPath = require('ensure-posix-path');
5
5
 
6
6
  module.exports = function resolvePath(importPath, fromFile, options) {
7
- let pathWithExtension = path.extname(importPath) ? importPath : (importPath + '.' + options.defaultExtension);
7
+ let pathWithExtension = path.extname(importPath)
8
+ ? importPath
9
+ : importPath + '.' + options.defaultExtension;
8
10
 
9
11
  if (isRelativePath(pathWithExtension)) {
10
12
  return resolveRelativePath(pathWithExtension, fromFile, options);
11
13
  } else if (isLocalPath(pathWithExtension, options)) {
12
14
  return resolveLocalPath(pathWithExtension, fromFile, options);
13
15
  } else if (isLocalPathWithOldPackageNameRef(pathWithExtension, options)) {
14
- const amendedPathWithExtension = pathWithExtension.replace(options.parentName, options.ownerName);
16
+ const amendedPathWithExtension = pathWithExtension.replace(
17
+ options.parentName,
18
+ options.ownerName
19
+ );
15
20
  options.ui.writeWarnLine(
16
21
  'For addons that define a moduleName, you should reference any CSS Modules provided by that addon ' +
17
- 'using its moduleName instead of the package name.\n' +
18
- 'Current path: ' + importPath + '\n' +
19
- 'Replace with: ' + importPath.replace(options.parentName, options.ownerName) + '\n' +
20
- 'File: ' + fromFile
22
+ 'using its moduleName instead of the package name.\n' +
23
+ 'Current path: ' +
24
+ importPath +
25
+ '\n' +
26
+ 'Replace with: ' +
27
+ importPath.replace(options.parentName, options.ownerName) +
28
+ '\n' +
29
+ 'File: ' +
30
+ fromFile
21
31
  );
22
32
  return resolveLocalPath(amendedPathWithExtension, fromFile, options);
23
33
  } else {
24
- return resolveExternalPath(pathWithExtension, importPath, fromFile, options);
34
+ return resolveExternalPath(
35
+ pathWithExtension,
36
+ importPath,
37
+ fromFile,
38
+ options
39
+ );
25
40
  }
26
41
  };
27
42
 
@@ -34,17 +49,24 @@ function isLocalPath(importPath, options) {
34
49
  }
35
50
 
36
51
  function isLocalPathWithOldPackageNameRef(importPath, options) {
37
- return (options.ownerName !== options.parentName) && importPath.indexOf(options.parentName + '/') === 0;
52
+ return (
53
+ options.ownerName !== options.parentName &&
54
+ importPath.indexOf(options.parentName + '/') === 0
55
+ );
38
56
  }
39
57
 
40
58
  function resolveRelativePath(importPath, fromFile, options) {
41
- let absolutePath = ensurePosixPath(path.resolve(path.dirname(fromFile), importPath));
59
+ let absolutePath = ensurePosixPath(
60
+ path.resolve(path.dirname(fromFile), importPath)
61
+ );
42
62
  return internalDep(absolutePath, options);
43
63
  }
44
64
 
45
65
  // Resolve absolute paths pointing to the same app/addon as the importer
46
66
  function resolveLocalPath(importPath, fromFile, options) {
47
- const fromFileStartsWithOwnerName = fromFile.substring(options.root.length + 1).startsWith(options.ownerName);
67
+ const fromFileStartsWithOwnerName = fromFile
68
+ .substring(options.root.length + 1)
69
+ .startsWith(options.ownerName);
48
70
 
49
71
  // Depending on the exact version of Ember CLI and/or Embroider in play, the
50
72
  // app/addon name may or may not be included in `fromFile`'s path. If not, we
@@ -71,15 +93,17 @@ function resolveExternalPath(importPath, originalPath, fromFile, options) {
71
93
  if (!addon) {
72
94
  throw new Error(
73
95
  `Unable to resolve styles module '${originalPath}' imported from '${fromFile}'. ` +
74
- `No virtual module with that name was defined and no corresponding addon was found.`
96
+ `No virtual module with that name was defined and no corresponding addon was found.`
75
97
  );
76
98
  }
77
99
 
78
100
  let pathWithinAddon = importPath.substring(addonName.length + 1);
79
101
  let addonTreePath = path.join(addon.root, addon.treePaths.addon);
80
102
 
81
- let absolutePath = ensurePosixPath(path.resolve(addonTreePath, pathWithinAddon));
82
- let keyPath = options.addonModulesRoot + addonName + '/' + pathWithinAddon;
103
+ let absolutePath = ensurePosixPath(
104
+ path.resolve(addonTreePath, pathWithinAddon)
105
+ );
106
+ let keyPath = addonName + '/' + pathWithinAddon;
83
107
  return new DependencyPath('external', absolutePath, keyPath);
84
108
  }
85
109
 
@@ -10,4 +10,4 @@ module.exports = function normalizePostcssPlugins(plugins) {
10
10
  }
11
11
 
12
12
  return result;
13
- }
13
+ };