ember-css-modules 1.3.4 → 1.6.1

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.
@@ -4,7 +4,7 @@ import { computed, defineProperty } from '@ember/object';
4
4
  import Mixin from '@ember/object/mixin';
5
5
  import { dasherize } from '@ember/string';
6
6
  import { getOwner } from '@ember/application';
7
- import { assert } from '@ember/debug';
7
+ import { assert, deprecate } from '@ember/debug';
8
8
 
9
9
  export default Mixin.create({
10
10
  localClassNames: null,
@@ -42,6 +42,22 @@ export default Mixin.create({
42
42
  layout
43
43
  );
44
44
 
45
+ deprecate(
46
+ 'Support for `localClassNames`, `localClassNameBindings` and the `@localClassName` and `@localClassNames` ' +
47
+ 'decorators will be removed in the next major release of ember-css-modules. The `' + name + '` component ' +
48
+ 'uses one or more of these APIs. See the ECM 1.5.0 release notes for further details and migration options: ' +
49
+ 'https://github.com/salsify/ember-css-modules/releases/tag/v1.5.0',
50
+ false,
51
+ {
52
+ id: 'ember-css-modules.classic-component-apis',
53
+ for: 'ember-css-modules',
54
+ until: '2.0.0',
55
+ since: {
56
+ enabled: '1.5.0'
57
+ }
58
+ }
59
+ );
60
+
45
61
  // Since https://github.com/emberjs/ember.js/pull/18096
46
62
  if (typeof layout === 'function') layout = layout(getOwner(this));
47
63
 
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) {
@@ -0,0 +1,18 @@
1
+ const semver = require('semver');
2
+ const postcssVersion = require('postcss/package.json').version;
3
+
4
+ if (semver.lt(postcssVersion, '8.0.0')) {
5
+ module.exports = require('postcss').plugin;
6
+ } else {
7
+ module.exports = function(name, callback) {
8
+ let plugin = (options = {}) => {
9
+ let handler = callback(options);
10
+ return {
11
+ postcssPlugin: name,
12
+ Once: handler
13
+ };
14
+ };
15
+ plugin.postcss = true;
16
+ return plugin;
17
+ };
18
+ }
@@ -194,7 +194,7 @@ module.exports = class ModulesPreprocessor {
194
194
  }
195
195
 
196
196
  rootPathPlugin() {
197
- return require('postcss').plugin('root-path-tag', () => (css) => {
197
+ return require('./make-postcss-plugin')('root-path-tag', () => (css) => {
198
198
  css.source.input.rootPath = this._modulesTree.inputPaths[0];
199
199
  });
200
200
  }
@@ -31,7 +31,8 @@ module.exports = class OutputStylesPreprocessor {
31
31
  debug('running postprocess plugins: %o', postprocessPlugins);
32
32
 
33
33
  concat = new PostCSS(concat, {
34
- plugins: postprocessPlugins
34
+ plugins: postprocessPlugins,
35
+ exclude: ['**/*.map']
35
36
  });
36
37
  }
37
38
 
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- const postcss = require('postcss');
4
3
  const ensurePosixPath = require('ensure-posix-path');
4
+ const makePostCSSPlugin = require('./make-postcss-plugin');
5
5
 
6
6
  // Report all discovered @after-module rules in a module and strip them out of the source
7
- module.exports = postcss.plugin('ember-css-modules-ordering', (options) => {
7
+ module.exports = makePostCSSPlugin('ember-css-modules-ordering', (options) => {
8
8
  return (css) => {
9
9
  let dependencies = [];
10
10
  let input = css.source.input;
@@ -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.3.4",
3
+ "version": "1.6.1",
4
4
  "description": "CSS Modules for ambitious applications",
5
5
  "scripts": {
6
6
  "build": "ember build",
@@ -51,7 +51,7 @@
51
51
  "eslint-plugin-ember": "^5.2.0",
52
52
  "eslint-plugin-node": "^7.0.1",
53
53
  "loader.js": "^4.7.0",
54
- "postcss-color-rebeccapurple": "^3.0.0",
54
+ "postcss-color-rebeccapurple": "^6.0.0",
55
55
  "qunit-dom": "^0.7.1",
56
56
  "qunitjs": "^2.4.1",
57
57
  "sinon": "^4.3.0",
@@ -71,19 +71,19 @@
71
71
  "dependencies": {
72
72
  "broccoli-bridge": "^1.0.0",
73
73
  "broccoli-concat": "^3.2.2",
74
- "broccoli-css-modules": "^0.7.0",
74
+ "broccoli-css-modules": "^0.7.0 || ^0.8.0",
75
75
  "broccoli-funnel": "^2.0.1",
76
76
  "broccoli-merge-trees": "^2.0.0",
77
- "broccoli-postcss": "^4.0.1",
77
+ "broccoli-postcss": "^4.0.1 || ^5.0.0 || ^6.0.0",
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",
85
85
  "lodash.merge": "^4.6.1",
86
- "postcss": "^6.0.19",
86
+ "postcss": "^7.0.35 || ^8.0.0",
87
87
  "semver": "^5.5.0",
88
88
  "toposort": "^1.0.6"
89
89
  },