Skip to content

Commit 56b2c99

Browse files
committed
Rebuild ember-css-modules on top of the new transform
1 parent ada2bb2 commit 56b2c99

File tree

31 files changed

+39
-1095
lines changed

31 files changed

+39
-1095
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from 'glimmer-local-class-transform/-runtime';

packages/ember-css-modules/addon/helpers/local-class.js

Lines changed: 0 additions & 34 deletions
This file was deleted.

packages/ember-css-modules/addon/index.js

Whitespace-only changes.

packages/ember-css-modules/addon/templates/static-helpers-hack.hbs

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/ember-css-modules/app/helpers/local-class.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/ember-css-modules/app/initializers/ensure-local-class-included.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

packages/ember-css-modules/ember-cli-build.js

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,6 @@ module.exports = function (defaults) {
1212
'ember-cli-babel': {
1313
throwUnlessParallelizable: true,
1414
},
15-
16-
cssModules: {
17-
_silenceAfterModuleDeprecation: true,
18-
headerModules: [
19-
'dummy/styles/testing/ordering/h',
20-
'dummy/styles/testing/ordering/g',
21-
],
22-
footerModules: [
23-
'dummy/styles/testing/ordering/t',
24-
'dummy/styles/testing/ordering/u',
25-
],
26-
virtualModules: {
27-
'virtual-constants': {
28-
superbold: 800,
29-
'important-background': 'rgb(255, 255, 0)',
30-
},
31-
},
32-
plugins: {
33-
postprocess: [require('postcss-color-rebeccapurple')()],
34-
},
35-
},
3615
});
3716

3817
const { maybeEmbroider } = require('@embroider/test-setup');

packages/ember-css-modules/index.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const path = require('path');
44
const fs = require('fs');
55
const debug = require('debug')('ember-css-modules:addon');
66

7-
const HtmlbarsPlugin = require('./lib/htmlbars-plugin');
7+
const { localClassRegistryPlugin } = require('glimmer-local-class-transform');
88
const ModulesPreprocessor = require('./lib/modules-preprocessor');
99
const OutputStylesPreprocessor = require('./lib/output-styles-preprocessor');
1010
const PluginRegistry = require('./lib/plugin/registry');
@@ -61,12 +61,20 @@ module.exports = {
6161
);
6262
}
6363

64+
let fileExtension = `.${this.getFileExtension()}`;
65+
let defaultExtension = this.includeExtensionInModulePath()
66+
? fileExtension
67+
: '';
68+
let runtimeModule = 'ember-css-modules/-runtime';
69+
let pathMapping = {
70+
'/template\\.hbs$': `/styles${defaultExtension}`,
71+
'/templates/(.*/)?(.*)\\.hbs$': `/styles/$1$2${defaultExtension}`,
72+
'(\\.g?[tj]s|\\.hbs)+$': fileExtension,
73+
};
74+
6475
this.parentPreprocessorRegistry.add(
6576
'htmlbars-ast-plugin',
66-
HtmlbarsPlugin.instantiate({
67-
fileExtension: this.getFileExtension(),
68-
includeExtensionInModulePath: this.includeExtensionInModulePath(),
69-
})
77+
localClassRegistryPlugin({ pathMapping, runtimeModule })
7078
);
7179
},
7280

@@ -151,9 +159,7 @@ module.exports = {
151159
},
152160

153161
getFileExtension() {
154-
return (
155-
(this.cssModulesOptions && this.cssModulesOptions.extension) || 'css'
156-
);
162+
return (this.cssModulesOptions.extension ?? 'css').replace(/^\./, '');
157163
},
158164

159165
includeExtensionInModulePath() {

packages/ember-css-modules/lib/htmlbars-plugin/index.js

Lines changed: 0 additions & 262 deletions
This file was deleted.

0 commit comments

Comments
 (0)