ember-css-modules 1.5.0 → 1.6.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.
package/index.js CHANGED
@@ -43,7 +43,13 @@ module.exports = {
43
43
 
44
44
  treeForAddon() {
45
45
  let addonTree = this._super.treeForAddon.apply(this, arguments);
46
- return new MergeTrees([addonTree, `${__dirname}/vendor`]);
46
+
47
+ // Allow to opt-out from automatic Component.reopen()
48
+ if (this.cssModulesOptions.patchClassicComponent !== false) {
49
+ return new MergeTrees([addonTree, `${__dirname}/vendor`]);
50
+ } else {
51
+ return addonTree;
52
+ }
47
53
  },
48
54
 
49
55
  cacheKeyForTree(treeType) {
@@ -44,18 +44,16 @@ function resolveRelativePath(importPath, fromFile, options) {
44
44
 
45
45
  // Resolve absolute paths pointing to the same app/addon as the importer
46
46
  function resolveLocalPath(importPath, fromFile, options) {
47
- let appOrAddonDirIndex = fromFile.indexOf(options.ownerName, options.root.length);
47
+ const fromFileStartsWithOwnerName = fromFile.substring(options.root.length + 1).startsWith(options.ownerName);
48
48
 
49
49
  // Depending on the exact version of Ember CLI and/or Embroider in play, the
50
50
  // app/addon name may or may not be included in `fromFile`'s path. If not, we
51
51
  // need to strip that prefix from the import path.
52
- if (appOrAddonDirIndex === -1) {
53
- appOrAddonDirIndex = options.root.length;
54
- importPath = ensurePosixPath(importPath).replace(new RegExp('^' + options.ownerName + '/?'), '');
52
+ if (!fromFileStartsWithOwnerName) {
53
+ importPath = importPath.substring(options.ownerName.length + 1);
55
54
  }
56
55
 
57
- let prefix = fromFile.substring(0, appOrAddonDirIndex);
58
- let absolutePath = ensurePosixPath(path.resolve(prefix, importPath));
56
+ let absolutePath = ensurePosixPath(path.resolve(options.root, importPath));
59
57
  return internalDep(absolutePath, options);
60
58
  }
61
59
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-css-modules",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "CSS Modules for ambitious applications",
5
5
  "scripts": {
6
6
  "build": "ember build",