ember-scoped-css 0.4.0 → 0.5.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/package.json
CHANGED
package/src/addon-js-unplugin.js
CHANGED
|
@@ -14,11 +14,11 @@ export default createUnplugin(() => {
|
|
|
14
14
|
name: 'addon-js-unplugin',
|
|
15
15
|
|
|
16
16
|
transformInclude(id) {
|
|
17
|
-
return id.endsWith('.js');
|
|
17
|
+
return id.endsWith('.js') || id.endsWith('.ts');
|
|
18
18
|
},
|
|
19
19
|
|
|
20
20
|
async transform(code, jsPath) {
|
|
21
|
-
const cssPath = jsPath.replace(/(\.hbs)?\.js$/, '.css');
|
|
21
|
+
const cssPath = jsPath.replace(/(\.hbs)?\.((js)|(ts))$/, '.css');
|
|
22
22
|
const cssFileName = path.basename(cssPath);
|
|
23
23
|
|
|
24
24
|
const cssExists = await fsExists(cssPath);
|
|
@@ -13,14 +13,16 @@ export default function () {
|
|
|
13
13
|
}
|
|
14
14
|
const postfix = getPostfix(id);
|
|
15
15
|
const jsPath = id.replace(/\.css$/, '.gjs');
|
|
16
|
+
const gtsPath = id.replace(/\.css$/, '.gts');
|
|
16
17
|
const hbsPath = id.replace(/\.css$/, '.hbs');
|
|
17
18
|
|
|
18
|
-
const [jsExists, hbsExists] = await Promise.all([
|
|
19
|
+
const [jsExists, gtsExists, hbsExists] = await Promise.all([
|
|
19
20
|
fsExists(jsPath),
|
|
21
|
+
fsExists(gtsPath),
|
|
20
22
|
fsExists(hbsPath),
|
|
21
23
|
]);
|
|
22
24
|
|
|
23
|
-
if (jsExists || hbsExists) {
|
|
25
|
+
if (jsExists || hbsExists || gtsExists) {
|
|
24
26
|
const rewritten = rewriteCss(code, postfix, path.basename(id));
|
|
25
27
|
return rewritten;
|
|
26
28
|
}
|
|
@@ -11,14 +11,14 @@ class ScopedClassHelperRule extends Rule {
|
|
|
11
11
|
if (node.params[0].type !== 'StringLiteral') {
|
|
12
12
|
this.log({
|
|
13
13
|
message:
|
|
14
|
-
'You cannot pass dynamic values to scoped-class helper. {{scoped-class "some-class"}}',
|
|
14
|
+
'You cannot pass dynamic values to scoped-class helper. {{scoped-class "some-class"}}. More info: https://github.com/soxhub/ember-scoped-css/blob/main/docs/lint-rules.md',
|
|
15
15
|
node,
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
} else {
|
|
19
19
|
this.log({
|
|
20
20
|
message:
|
|
21
|
-
'
|
|
21
|
+
'One positional param is required to be passed to scoped-class helper. {{scoped-class "some-class"}}. More info: https://github.com/soxhub/ember-scoped-css/blob/main/docs/lint-rules.md',
|
|
22
22
|
node,
|
|
23
23
|
});
|
|
24
24
|
}
|
|
@@ -19,7 +19,7 @@ generateRuleTests({
|
|
|
19
19
|
assert.equal(results.length, 1);
|
|
20
20
|
assert.equal(
|
|
21
21
|
results[0].message,
|
|
22
|
-
'
|
|
22
|
+
'One positional param is required to be passed to scoped-class helper. {{scoped-class "some-class"}}. More info: https://github.com/soxhub/ember-scoped-css/blob/main/docs/lint-rules.md'
|
|
23
23
|
);
|
|
24
24
|
},
|
|
25
25
|
},
|
|
@@ -30,7 +30,7 @@ generateRuleTests({
|
|
|
30
30
|
assert.equal(results.length, 1);
|
|
31
31
|
assert.equal(
|
|
32
32
|
results[0].message,
|
|
33
|
-
'You cannot pass dynamic values to scoped-class helper. {{scoped-class "some-class"}}'
|
|
33
|
+
'You cannot pass dynamic values to scoped-class helper. {{scoped-class "some-class"}}. More info: https://github.com/soxhub/ember-scoped-css/blob/main/docs/lint-rules.md'
|
|
34
34
|
);
|
|
35
35
|
},
|
|
36
36
|
},
|