ember-css-modules 1.5.0 → 1.6.2
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 +7 -1
- package/lib/htmlbars-plugin/index.js +12 -1
- package/lib/resolve-path.js +4 -6
- package/package.json +4 -4
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
|
-
|
|
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) {
|
|
@@ -152,7 +152,18 @@ module.exports = class ClassTransformPlugin {
|
|
|
152
152
|
|
|
153
153
|
utils.pushAll(parts, this.localToPath(localClassAttr.value));
|
|
154
154
|
this.divide(parts, this.isGlimmer ? 'text' : 'string');
|
|
155
|
-
|
|
155
|
+
|
|
156
|
+
let newClassAttr = this.builders.attr('class', this.builders.concat(parts));
|
|
157
|
+
node.attributes.unshift(newClassAttr);
|
|
158
|
+
|
|
159
|
+
// In new-enough versions of Ember (>= 3.25 or so), we need to create a
|
|
160
|
+
// fake good-enough `loc` whose content will start with `class=` to avoid
|
|
161
|
+
// triggering https://github.com/emberjs/ember.js/issues/19392
|
|
162
|
+
if (typeof localClassAttr.loc.slice === 'function') {
|
|
163
|
+
newClassAttr.loc = localClassAttr.loc.slice({
|
|
164
|
+
skipStart: 'local-'.length,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
156
167
|
}
|
|
157
168
|
|
|
158
169
|
localToPath(node) {
|
package/lib/resolve-path.js
CHANGED
|
@@ -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
|
-
|
|
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 (
|
|
53
|
-
|
|
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
|
|
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.
|
|
3
|
+
"version": "1.6.2",
|
|
4
4
|
"description": "CSS Modules for ambitious applications",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "ember build",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"broccoli-plugin": "^1.3.1",
|
|
26
26
|
"console-ui": "^2.2.2",
|
|
27
27
|
"ember-ajax": "^3.1.0",
|
|
28
|
-
"ember-auto-import": "^
|
|
28
|
+
"ember-auto-import": "^2.4.0",
|
|
29
29
|
"ember-cli": "~3.4.1",
|
|
30
30
|
"ember-cli-addon-tests": "^0.11.0",
|
|
31
31
|
"ember-cli-dependency-checker": "^3.0.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"qunitjs": "^2.4.1",
|
|
57
57
|
"sinon": "^4.3.0",
|
|
58
58
|
"template-stuff": "link:tests/dummy/lib/template-stuff",
|
|
59
|
-
"webpack": "^
|
|
59
|
+
"webpack": "^5.70.0"
|
|
60
60
|
},
|
|
61
61
|
"keywords": [
|
|
62
62
|
"ember-addon",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"calculate-cache-key-for-tree": "^1.1.0",
|
|
79
79
|
"debug": "^3.1.0",
|
|
80
80
|
"ember-cli-babel": "^7.7.3",
|
|
81
|
-
"ember-cli-htmlbars": "^3.0.0",
|
|
81
|
+
"ember-cli-htmlbars": "^3.0.0 || ^6.0.0",
|
|
82
82
|
"ember-cli-version-checker": "^2.1.0",
|
|
83
83
|
"ensure-posix-path": "^1.0.2",
|
|
84
84
|
"hash-string": "^1.0.0",
|