ember-scoped-css 3.2.0 → 3.3.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/dist/cjs/all.cjs CHANGED
@@ -1,3 +1,3 @@
1
- const require_all = require('./all-DJjr6YEx.cjs');
1
+ const require_all = require('./all-Cl5IZZ-T.cjs');
2
2
 
3
3
  exports.scopedCSS = require_all.scopedCSS;
@@ -1,4 +1,4 @@
1
- const require_all = require('./all-DJjr6YEx.cjs');
1
+ const require_all = require('./all-Cl5IZZ-T.cjs');
2
2
 
3
3
  //#region src/build/public-exports/babel.js
4
4
  const scopedCSS = require_all.scopedCSS.babel;
@@ -1,4 +1,4 @@
1
- const require_all = require('./all-DJjr6YEx.cjs');
1
+ const require_all = require('./all-Cl5IZZ-T.cjs');
2
2
 
3
3
  //#region src/build/public-exports/rollup.js
4
4
  const scopedCSS = require_all.scopedCSS.rollup;
package/dist/cjs/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_all = require('./all-DJjr6YEx.cjs');
1
+ const require_all = require('./all-Cl5IZZ-T.cjs');
2
2
 
3
3
  //#region src/build/public-exports/vite.js
4
4
  const scopedCSS = require_all.scopedCSS.vite;
@@ -383,6 +383,11 @@ function splitClassList(classList) {
383
383
  return classList.split(/\s+/).filter(Boolean);
384
384
  }
385
385
  /**
386
+ * Postfixes every class in `className`, which may be a space-separated list.
387
+ *
388
+ * `classesInCss` is consulted one class at a time, so it has to be keyed on
389
+ * individual class names — a Set built from a whole space-separated list
390
+ * matches nothing. Omit it to postfix every class unconditionally.
386
391
  *
387
392
  * @param {string} className
388
393
  * @param {string} postfix
@@ -1 +1 @@
1
- {"version":3,"file":"test-support.js","names":["hash"],"sources":["../../src/lib/path/md5.js","../../src/lib/path/hash-from-module-path.js","../../src/lib/renameClass.js","../../src/runtime/test-support.ts"],"sourcesContent":["/*\n * JavaScript MD5\n * https://github.com/blueimp/JavaScript-MD5\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on\n * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\n * Digest Algorithm, as defined in RFC 1321.\n * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for more info.\n *\n * Modifications:\n * - removed IIFE, exported md5 (this file is now ESM)\n */\n\n/**\n * Add integers, wrapping at 2^32.\n * This uses 16-bit operations internally to work around bugs in interpreters.\n *\n * @param {number} x First integer\n * @param {number} y Second integer\n * @returns {number} Sum\n */\nfunction safeAdd(x, y) {\n var lsw = (x & 0xffff) + (y & 0xffff);\n var msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n\n return (msw << 16) | (lsw & 0xffff);\n}\n\n/**\n * Bitwise rotate a 32-bit number to the left.\n *\n * @param {number} num 32-bit number\n * @param {number} cnt Rotation count\n * @returns {number} Rotated number\n */\nfunction bitRotateLeft(num, cnt) {\n return (num << cnt) | (num >>> (32 - cnt));\n}\n\n/**\n * Basic operation the algorithm uses.\n *\n * @param {number} q q\n * @param {number} a a\n * @param {number} b b\n * @param {number} x x\n * @param {number} s s\n * @param {number} t t\n * @returns {number} Result\n */\nfunction md5cmn(q, a, b, x, s, t) {\n return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);\n}\n\n/**\n * Basic operation the algorithm uses.\n *\n * @param {number} a a\n * @param {number} b b\n * @param {number} c c\n * @param {number} d d\n * @param {number} x x\n * @param {number} s s\n * @param {number} t t\n * @returns {number} Result\n */\nfunction md5ff(a, b, c, d, x, s, t) {\n return md5cmn((b & c) | (~b & d), a, b, x, s, t);\n}\n\n/**\n * Basic operation the algorithm uses.\n *\n * @param {number} a a\n * @param {number} b b\n * @param {number} c c\n * @param {number} d d\n * @param {number} x x\n * @param {number} s s\n * @param {number} t t\n * @returns {number} Result\n */\nfunction md5gg(a, b, c, d, x, s, t) {\n return md5cmn((b & d) | (c & ~d), a, b, x, s, t);\n}\n\n/**\n * Basic operation the algorithm uses.\n *\n * @param {number} a a\n * @param {number} b b\n * @param {number} c c\n * @param {number} d d\n * @param {number} x x\n * @param {number} s s\n * @param {number} t t\n * @returns {number} Result\n */\nfunction md5hh(a, b, c, d, x, s, t) {\n return md5cmn(b ^ c ^ d, a, b, x, s, t);\n}\n\n/**\n * Basic operation the algorithm uses.\n *\n * @param {number} a a\n * @param {number} b b\n * @param {number} c c\n * @param {number} d d\n * @param {number} x x\n * @param {number} s s\n * @param {number} t t\n * @returns {number} Result\n */\nfunction md5ii(a, b, c, d, x, s, t) {\n return md5cmn(c ^ (b | ~d), a, b, x, s, t);\n}\n\n/**\n * Calculate the MD5 of an array of little-endian words, and a bit length.\n *\n * @param {Array} x Array of little-endian words\n * @param {number} len Bit length\n * @returns {Array<number>} MD5 Array\n */\nfunction binlMD5(x, len) {\n /* append padding */\n x[len >> 5] |= 0x80 << len % 32;\n x[(((len + 64) >>> 9) << 4) + 14] = len;\n\n var i;\n var olda;\n var oldb;\n var oldc;\n var oldd;\n var a = 1732584193;\n var b = -271733879;\n var c = -1732584194;\n var d = 271733878;\n\n for (i = 0; i < x.length; i += 16) {\n olda = a;\n oldb = b;\n oldc = c;\n oldd = d;\n\n a = md5ff(a, b, c, d, x[i], 7, -680876936);\n d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);\n c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);\n b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);\n a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);\n d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);\n c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);\n b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);\n a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);\n d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);\n c = md5ff(c, d, a, b, x[i + 10], 17, -42063);\n b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);\n a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);\n d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);\n c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);\n b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);\n\n a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);\n d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);\n c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);\n b = md5gg(b, c, d, a, x[i], 20, -373897302);\n a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);\n d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);\n c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);\n b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);\n a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);\n d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);\n c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);\n b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);\n a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);\n d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);\n c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);\n b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);\n\n a = md5hh(a, b, c, d, x[i + 5], 4, -378558);\n d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);\n c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);\n b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);\n a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);\n d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);\n c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);\n b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);\n a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);\n d = md5hh(d, a, b, c, x[i], 11, -358537222);\n c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);\n b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);\n a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);\n d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);\n c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);\n b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);\n\n a = md5ii(a, b, c, d, x[i], 6, -198630844);\n d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);\n c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);\n b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);\n a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);\n d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);\n c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);\n b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);\n a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);\n d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);\n c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);\n b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);\n a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);\n d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);\n c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);\n b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);\n\n a = safeAdd(a, olda);\n b = safeAdd(b, oldb);\n c = safeAdd(c, oldc);\n d = safeAdd(d, oldd);\n }\n\n return [a, b, c, d];\n}\n\n/**\n * Convert an array of little-endian words to a string\n *\n * @param {Array<number>} input MD5 Array\n * @returns {string} MD5 string\n */\nfunction binl2rstr(input) {\n var i;\n var output = '';\n var length32 = input.length * 32;\n\n for (i = 0; i < length32; i += 8) {\n output += String.fromCharCode((input[i >> 5] >>> i % 32) & 0xff);\n }\n\n return output;\n}\n\n/**\n * Convert a raw string to an array of little-endian words\n * Characters >255 have their high-byte silently ignored.\n *\n * @param {string} input Raw input string\n * @returns {Array<number>} Array of little-endian words\n */\nfunction rstr2binl(input) {\n var i;\n var output = [];\n output[(input.length >> 2) - 1] = undefined;\n\n for (i = 0; i < output.length; i += 1) {\n output[i] = 0;\n }\n\n var length8 = input.length * 8;\n\n for (i = 0; i < length8; i += 8) {\n output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << i % 32;\n }\n\n return output;\n}\n\n/**\n * Calculate the MD5 of a raw string\n *\n * @param {string} s Input string\n * @returns {string} Raw MD5 string\n */\nfunction rstrMD5(s) {\n return binl2rstr(binlMD5(rstr2binl(s), s.length * 8));\n}\n\n/**\n * Calculates the HMAC-MD5 of a key and some data (raw strings)\n *\n * @param {string} key HMAC key\n * @param {string} data Raw input string\n * @returns {string} Raw MD5 string\n */\nfunction rstrHMACMD5(key, data) {\n var i;\n var bkey = rstr2binl(key);\n var ipad = [];\n var opad = [];\n var hash;\n ipad[15] = opad[15] = undefined;\n\n if (bkey.length > 16) {\n bkey = binlMD5(bkey, key.length * 8);\n }\n\n for (i = 0; i < 16; i += 1) {\n ipad[i] = bkey[i] ^ 0x36363636;\n opad[i] = bkey[i] ^ 0x5c5c5c5c;\n }\n\n hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);\n\n return binl2rstr(binlMD5(opad.concat(hash), 512 + 128));\n}\n\n/**\n * Convert a raw string to a hex string\n *\n * @param {string} input Raw input string\n * @returns {string} Hex encoded string\n */\nfunction rstr2hex(input) {\n var hexTab = '0123456789abcdef';\n var output = '';\n var x;\n var i;\n\n for (i = 0; i < input.length; i += 1) {\n x = input.charCodeAt(i);\n output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f);\n }\n\n return output;\n}\n\n/**\n * Encode a string as UTF-8\n *\n * @param {string} input Input string\n * @returns {string} UTF8 string\n */\nfunction str2rstrUTF8(input) {\n return unescape(encodeURIComponent(input));\n}\n\n/**\n * Encodes input string as raw MD5 string\n *\n * @param {string} s Input string\n * @returns {string} Raw MD5 string\n */\nfunction rawMD5(s) {\n return rstrMD5(str2rstrUTF8(s));\n}\n\n/**\n * Encodes input string as Hex encoded string\n *\n * @param {string} s Input string\n * @returns {string} Hex encoded string\n */\nfunction hexMD5(s) {\n return rstr2hex(rawMD5(s));\n}\n\n/**\n * Calculates the raw HMAC-MD5 for the given key and data\n *\n * @param {string} k HMAC key\n * @param {string} d Input string\n * @returns {string} Raw MD5 string\n */\nfunction rawHMACMD5(k, d) {\n return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d));\n}\n\n/**\n * Calculates the Hex encoded HMAC-MD5 for the given key and data\n *\n * @param {string} k HMAC key\n * @param {string} d Input string\n * @returns {string} Raw MD5 string\n */\nfunction hexHMACMD5(k, d) {\n return rstr2hex(rawHMACMD5(k, d));\n}\n\n/**\n * Calculates MD5 value for a given string.\n * If a key is provided, calculates the HMAC-MD5 value.\n * Returns a Hex encoded string unless the raw argument is given.\n *\n * @param {string} string Input string\n * @param {string} [key] HMAC key\n * @param {boolean} [raw] Raw output switch\n * @returns {string} MD5 output\n */\nexport function md5(string, key, raw) {\n if (!key) {\n if (!raw) {\n return hexMD5(string);\n }\n\n return rawMD5(string);\n }\n\n if (!raw) {\n return hexHMACMD5(key, string);\n }\n\n return rawHMACMD5(key, string);\n}\n","import { md5 } from './md5.js';\n\n/**\n * The intent of this function is to generate the suffix/postfix for the\n * css classes, based on the module-scoped path name.\n *\n * for example,\n * hash('my-app/components/foo')\n * instead of\n * hash('app/components/foo')\n *\n * (unless your app name is 'app')\n *\n * @param {string} modulePath\n * @returns {string}\n */\nexport function hash(modulePath) {\n return 'e' + md5(modulePath).substring(0, 8);\n}\n\nif (import.meta.vitest) {\n const { it, expect } = import.meta.vitest;\n\n it('should return a string', function () {\n const postfix = hash('foo.css');\n\n expect(postfix).to.be.a('string');\n });\n\n it('should return a string starting with \"e\"', function () {\n const postfix = hash('foo.css');\n\n expect(postfix).to.match(/^e/);\n });\n\n it('should return a string of length 9', function () {\n const postfix = hash('foo.css');\n\n expect(postfix).to.have.lengthOf(9);\n });\n}\n\nexport const hashFromModulePath = hash;\n","/**\n * Splits a space-separated class list (the value of a `class` attribute or of\n * a `[class=\"...\"]` selector) into its individual class names.\n *\n * @param {string} classList\n * @returns {string[]}\n */\nexport function splitClassList(classList) {\n return classList.split(/\\s+/).filter(Boolean);\n}\n\n/**\n *\n * @param {string} className\n * @param {string} postfix\n * @param {Set<string>} [classesInCss]\n * @returns\n */\nexport function renameClass(className, postfix, classesInCss) {\n const renamedClasses = splitClassList(className)\n .map((c) => {\n if (!classesInCss || classesInCss.has(c)) {\n if (c.endsWith(postfix)) return c;\n\n return c + '_' + postfix;\n }\n\n return c;\n })\n .join(' ');\n\n const renamedWithPreservedSpaces = className.replace(\n className.trimStart().trimEnd(),\n renamedClasses,\n );\n\n return renamedWithPreservedSpaces;\n}\n","import { hash } from '../lib/path/hash-from-module-path.js';\nimport { renameClass } from '../lib/renameClass.js';\n\n/**\n * On element selectors where there are no classes,\n * you may pass only the modulePath and get the hash for the element.\n *\n * For example, in app code,\n * with template code `<h3>x</h3>`\n * and css `h3 { }`\n * a class will be added during the build, result in:\n * the template: `<h3 class=\"some-hash\">x</h3>`\n * and css `h3.some-hash { }`\n *\n * @example\n * If a file is located at `app/components/foo/bar.hbs`\n * The associated css should be at `app/components/foo/bar.css`\n * and the path passed to `scopedClass` should be `<modulePrefix>/components/foo/bar`\n *\n * @example\n * If a file is located at `app/templates/bar.hbs`\n * The associated css should be at `app/templates/bar.css`\n * and the path passed to `scopedClass` should be `<modulePrefix>/templates/bar`\n *\n * @example\n * If a file is located at `<podModulePrefix>/bar/template.hbs`\n * The associated css should be at `app/<podModulePrefix sub path>/bar/styles.css`\n * and the path passed to `scopedClass` should be `<podModulePrefix>/bar`\n *\n */\nexport function scopedClass(modulePath: string): string;\n\n/**\n * Retrieve the built hash for a class.\n *\n * For example, in app code,\n * with template code `<h3 class=\"foo\">x</h3>`\n * and css `.foo { }`\n * a hash will be added during the build, resulting in:\n * the template: `<h3 class=\"foo_some-hash\">x</h3>`\n * and css `.foo_some-hash { }`\n *\n * @example\n * If a file is located at `app/components/foo/bar.hbs`\n * The associated css should be at `app/components/foo/bar.css`\n * and the path passed to `scopedClass` should be `<modulePrefix>/components/foo/bar`\n *\n * @example\n * If a file is located at `app/templates/bar.hbs`\n * The associated css should be at `app/templates/bar.css`\n * and the path passed to `scopedClass` should be `<modulePrefix>/templates/bar`\n *\n * @example\n * If a file is located at `<podModulePrefix>/bar/template.hbs`\n * The associated css should be at `app/<podModulePrefix sub path>/bar/styles.css`\n * and the path passed to `scopedClass` should be `<podModulePrefix>/bar`\n *\n */\nexport function scopedClass(className: string, modulePath: string): string;\n\nexport function scopedClass(\n ...args: [modulepath: string] | [className: string, modulePath: string]\n) {\n if (args.length === 1) {\n return hash(args[0]);\n }\n\n let [className, modulePath] = args;\n\n const postfix = hash(modulePath);\n\n return renameClass(className, postfix);\n}\n"],"mappings":";;;;;;;;;AA8BA,SAAS,QAAQ,GAAG,GAAG;CACrB,IAAI,OAAO,IAAI,UAAW,IAAI;AAG9B,SAFW,KAAK,OAAO,KAAK,OAAO,OAAO,OAE3B,KAAO,MAAM;;;;;;;;;AAU9B,SAAS,cAAc,KAAK,KAAK;AAC/B,QAAQ,OAAO,MAAQ,QAAS,KAAK;;;;;;;;;;;;;AAcvC,SAAS,OAAO,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG;AAChC,QAAO,QAAQ,cAAc,QAAQ,QAAQ,GAAG,EAAE,EAAE,QAAQ,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE;;;;;;;;;;;;;;AAe5E,SAAS,MAAM,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG;AAClC,QAAO,OAAQ,IAAI,IAAM,CAAC,IAAI,GAAI,GAAG,GAAG,GAAG,GAAG,EAAE;;;;;;;;;;;;;;AAelD,SAAS,MAAM,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG;A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sources":["../../src/lib/path/md5.js","../../src/lib/path/hash-from-module-path.js","../../src/lib/renameClass.js","../../src/runtime/test-support.ts"],"sourcesContent":["/*\n * JavaScript MD5\n * https://github.com/blueimp/JavaScript-MD5\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on\n * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\n * Digest Algorithm, as defined in RFC 1321.\n * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for more info.\n *\n * Modifications:\n * - removed IIFE, exported md5 (this file is now ESM)\n */\n\n/**\n * Add integers, wrapping at 2^32.\n * This uses 16-bit operations internally to work around bugs in interpreters.\n *\n * @param {number} x First integer\n * @param {number} y Second integer\n * @returns {number} Sum\n */\nfunction safeAdd(x, y) {\n var lsw = (x & 0xffff) + (y & 0xffff);\n var msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n\n return (msw << 16) | (lsw & 0xffff);\n}\n\n/**\n * Bitwise rotate a 32-bit number to the left.\n *\n * @param {number} num 32-bit number\n * @param {number} cnt Rotation count\n * @returns {number} Rotated number\n */\nfunction bitRotateLeft(num, cnt) {\n return (num << cnt) | (num >>> (32 - cnt));\n}\n\n/**\n * Basic operation the algorithm uses.\n *\n * @param {number} q q\n * @param {number} a a\n * @param {number} b b\n * @param {number} x x\n * @param {number} s s\n * @param {number} t t\n * @returns {number} Result\n */\nfunction md5cmn(q, a, b, x, s, t) {\n return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);\n}\n\n/**\n * Basic operation the algorithm uses.\n *\n * @param {number} a a\n * @param {number} b b\n * @param {number} c c\n * @param {number} d d\n * @param {number} x x\n * @param {number} s s\n * @param {number} t t\n * @returns {number} Result\n */\nfunction md5ff(a, b, c, d, x, s, t) {\n return md5cmn((b & c) | (~b & d), a, b, x, s, t);\n}\n\n/**\n * Basic operation the algorithm uses.\n *\n * @param {number} a a\n * @param {number} b b\n * @param {number} c c\n * @param {number} d d\n * @param {number} x x\n * @param {number} s s\n * @param {number} t t\n * @returns {number} Result\n */\nfunction md5gg(a, b, c, d, x, s, t) {\n return md5cmn((b & d) | (c & ~d), a, b, x, s, t);\n}\n\n/**\n * Basic operation the algorithm uses.\n *\n * @param {number} a a\n * @param {number} b b\n * @param {number} c c\n * @param {number} d d\n * @param {number} x x\n * @param {number} s s\n * @param {number} t t\n * @returns {number} Result\n */\nfunction md5hh(a, b, c, d, x, s, t) {\n return md5cmn(b ^ c ^ d, a, b, x, s, t);\n}\n\n/**\n * Basic operation the algorithm uses.\n *\n * @param {number} a a\n * @param {number} b b\n * @param {number} c c\n * @param {number} d d\n * @param {number} x x\n * @param {number} s s\n * @param {number} t t\n * @returns {number} Result\n */\nfunction md5ii(a, b, c, d, x, s, t) {\n return md5cmn(c ^ (b | ~d), a, b, x, s, t);\n}\n\n/**\n * Calculate the MD5 of an array of little-endian words, and a bit length.\n *\n * @param {Array} x Array of little-endian words\n * @param {number} len Bit length\n * @returns {Array<number>} MD5 Array\n */\nfunction binlMD5(x, len) {\n /* append padding */\n x[len >> 5] |= 0x80 << len % 32;\n x[(((len + 64) >>> 9) << 4) + 14] = len;\n\n var i;\n var olda;\n var oldb;\n var oldc;\n var oldd;\n var a = 1732584193;\n var b = -271733879;\n var c = -1732584194;\n var d = 271733878;\n\n for (i = 0; i < x.length; i += 16) {\n olda = a;\n oldb = b;\n oldc = c;\n oldd = d;\n\n a = md5ff(a, b, c, d, x[i], 7, -680876936);\n d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);\n c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);\n b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);\n a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);\n d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);\n c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);\n b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);\n a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);\n d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);\n c = md5ff(c, d, a, b, x[i + 10], 17, -42063);\n b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);\n a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);\n d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);\n c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);\n b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);\n\n a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);\n d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);\n c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);\n b = md5gg(b, c, d, a, x[i], 20, -373897302);\n a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);\n d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);\n c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);\n b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);\n a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);\n d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);\n c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);\n b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);\n a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);\n d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);\n c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);\n b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);\n\n a = md5hh(a, b, c, d, x[i + 5], 4, -378558);\n d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);\n c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);\n b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);\n a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);\n d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);\n c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);\n b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);\n a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);\n d = md5hh(d, a, b, c, x[i], 11, -358537222);\n c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);\n b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);\n a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);\n d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);\n c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);\n b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);\n\n a = md5ii(a, b, c, d, x[i], 6, -198630844);\n d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);\n c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);\n b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);\n a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);\n d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);\n c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);\n b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);\n a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);\n d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);\n c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);\n b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);\n a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);\n d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);\n c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);\n b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);\n\n a = safeAdd(a, olda);\n b = safeAdd(b, oldb);\n c = safeAdd(c, oldc);\n d = safeAdd(d, oldd);\n }\n\n return [a, b, c, d];\n}\n\n/**\n * Convert an array of little-endian words to a string\n *\n * @param {Array<number>} input MD5 Array\n * @returns {string} MD5 string\n */\nfunction binl2rstr(input) {\n var i;\n var output = '';\n var length32 = input.length * 32;\n\n for (i = 0; i < length32; i += 8) {\n output += String.fromCharCode((input[i >> 5] >>> i % 32) & 0xff);\n }\n\n return output;\n}\n\n/**\n * Convert a raw string to an array of little-endian words\n * Characters >255 have their high-byte silently ignored.\n *\n * @param {string} input Raw input string\n * @returns {Array<number>} Array of little-endian words\n */\nfunction rstr2binl(input) {\n var i;\n var output = [];\n output[(input.length >> 2) - 1] = undefined;\n\n for (i = 0; i < output.length; i += 1) {\n output[i] = 0;\n }\n\n var length8 = input.length * 8;\n\n for (i = 0; i < length8; i += 8) {\n output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << i % 32;\n }\n\n return output;\n}\n\n/**\n * Calculate the MD5 of a raw string\n *\n * @param {string} s Input string\n * @returns {string} Raw MD5 string\n */\nfunction rstrMD5(s) {\n return binl2rstr(binlMD5(rstr2binl(s), s.length * 8));\n}\n\n/**\n * Calculates the HMAC-MD5 of a key and some data (raw strings)\n *\n * @param {string} key HMAC key\n * @param {string} data Raw input string\n * @returns {string} Raw MD5 string\n */\nfunction rstrHMACMD5(key, data) {\n var i;\n var bkey = rstr2binl(key);\n var ipad = [];\n var opad = [];\n var hash;\n ipad[15] = opad[15] = undefined;\n\n if (bkey.length > 16) {\n bkey = binlMD5(bkey, key.length * 8);\n }\n\n for (i = 0; i < 16; i += 1) {\n ipad[i] = bkey[i] ^ 0x36363636;\n opad[i] = bkey[i] ^ 0x5c5c5c5c;\n }\n\n hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);\n\n return binl2rstr(binlMD5(opad.concat(hash), 512 + 128));\n}\n\n/**\n * Convert a raw string to a hex string\n *\n * @param {string} input Raw input string\n * @returns {string} Hex encoded string\n */\nfunction rstr2hex(input) {\n var hexTab = '0123456789abcdef';\n var output = '';\n var x;\n var i;\n\n for (i = 0; i < input.length; i += 1) {\n x = input.charCodeAt(i);\n output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f);\n }\n\n return output;\n}\n\n/**\n * Encode a string as UTF-8\n *\n * @param {string} input Input string\n * @returns {string} UTF8 string\n */\nfunction str2rstrUTF8(input) {\n return unescape(encodeURIComponent(input));\n}\n\n/**\n * Encodes input string as raw MD5 string\n *\n * @param {string} s Input string\n * @returns {string} Raw MD5 string\n */\nfunction rawMD5(s) {\n return rstrMD5(str2rstrUTF8(s));\n}\n\n/**\n * Encodes input string as Hex encoded string\n *\n * @param {string} s Input string\n * @returns {string} Hex encoded string\n */\nfunction hexMD5(s) {\n return rstr2hex(rawMD5(s));\n}\n\n/**\n * Calculates the raw HMAC-MD5 for the given key and data\n *\n * @param {string} k HMAC key\n * @param {string} d Input string\n * @returns {string} Raw MD5 string\n */\nfunction rawHMACMD5(k, d) {\n return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d));\n}\n\n/**\n * Calculates the Hex encoded HMAC-MD5 for the given key and data\n *\n * @param {string} k HMAC key\n * @param {string} d Input string\n * @returns {string} Raw MD5 string\n */\nfunction hexHMACMD5(k, d) {\n return rstr2hex(rawHMACMD5(k, d));\n}\n\n/**\n * Calculates MD5 value for a given string.\n * If a key is provided, calculates the HMAC-MD5 value.\n * Returns a Hex encoded string unless the raw argument is given.\n *\n * @param {string} string Input string\n * @param {string} [key] HMAC key\n * @param {boolean} [raw] Raw output switch\n * @returns {string} MD5 output\n */\nexport function md5(string, key, raw) {\n if (!key) {\n if (!raw) {\n return hexMD5(string);\n }\n\n return rawMD5(string);\n }\n\n if (!raw) {\n return hexHMACMD5(key, string);\n }\n\n return rawHMACMD5(key, string);\n}\n","import { md5 } from './md5.js';\n\n/**\n * The intent of this function is to generate the suffix/postfix for the\n * css classes, based on the module-scoped path name.\n *\n * for example,\n * hash('my-app/components/foo')\n * instead of\n * hash('app/components/foo')\n *\n * (unless your app name is 'app')\n *\n * @param {string} modulePath\n * @returns {string}\n */\nexport function hash(modulePath) {\n return 'e' + md5(modulePath).substring(0, 8);\n}\n\nif (import.meta.vitest) {\n const { it, expect } = import.meta.vitest;\n\n it('should return a string', function () {\n const postfix = hash('foo.css');\n\n expect(postfix).to.be.a('string');\n });\n\n it('should return a string starting with \"e\"', function () {\n const postfix = hash('foo.css');\n\n expect(postfix).to.match(/^e/);\n });\n\n it('should return a string of length 9', function () {\n const postfix = hash('foo.css');\n\n expect(postfix).to.have.lengthOf(9);\n });\n}\n\nexport const hashFromModulePath = hash;\n","/**\n * Splits a space-separated class list (the value of a `class` attribute or of\n * a `[class=\"...\"]` selector) into its individual class names.\n *\n * @param {string} classList\n * @returns {string[]}\n */\nexport function splitClassList(classList) {\n return classList.split(/\\s+/).filter(Boolean);\n}\n\n/**\n * Postfixes every class in `className`, which may be a space-separated list.\n *\n * `classesInCss` is consulted one class at a time, so it has to be keyed on\n * individual class names — a Set built from a whole space-separated list\n * matches nothing. Omit it to postfix every class unconditionally.\n *\n * @param {string} className\n * @param {string} postfix\n * @param {Set<string>} [classesInCss]\n * @returns\n */\nexport function renameClass(className, postfix, classesInCss) {\n const renamedClasses = splitClassList(className)\n .map((c) => {\n if (!classesInCss || classesInCss.has(c)) {\n if (c.endsWith(postfix)) return c;\n\n return c + '_' + postfix;\n }\n\n return c;\n })\n .join(' ');\n\n const renamedWithPreservedSpaces = className.replace(\n className.trimStart().trimEnd(),\n renamedClasses,\n );\n\n return renamedWithPreservedSpaces;\n}\n","import { hash } from '../lib/path/hash-from-module-path.js';\nimport { renameClass } from '../lib/renameClass.js';\n\n/**\n * On element selectors where there are no classes,\n * you may pass only the modulePath and get the hash for the element.\n *\n * For example, in app code,\n * with template code `<h3>x</h3>`\n * and css `h3 { }`\n * a class will be added during the build, result in:\n * the template: `<h3 class=\"some-hash\">x</h3>`\n * and css `h3.some-hash { }`\n *\n * @example\n * If a file is located at `app/components/foo/bar.hbs`\n * The associated css should be at `app/components/foo/bar.css`\n * and the path passed to `scopedClass` should be `<modulePrefix>/components/foo/bar`\n *\n * @example\n * If a file is located at `app/templates/bar.hbs`\n * The associated css should be at `app/templates/bar.css`\n * and the path passed to `scopedClass` should be `<modulePrefix>/templates/bar`\n *\n * @example\n * If a file is located at `<podModulePrefix>/bar/template.hbs`\n * The associated css should be at `app/<podModulePrefix sub path>/bar/styles.css`\n * and the path passed to `scopedClass` should be `<podModulePrefix>/bar`\n *\n */\nexport function scopedClass(modulePath: string): string;\n\n/**\n * Retrieve the built hash for a class.\n *\n * For example, in app code,\n * with template code `<h3 class=\"foo\">x</h3>`\n * and css `.foo { }`\n * a hash will be added during the build, resulting in:\n * the template: `<h3 class=\"foo_some-hash\">x</h3>`\n * and css `.foo_some-hash { }`\n *\n * @example\n * If a file is located at `app/components/foo/bar.hbs`\n * The associated css should be at `app/components/foo/bar.css`\n * and the path passed to `scopedClass` should be `<modulePrefix>/components/foo/bar`\n *\n * @example\n * If a file is located at `app/templates/bar.hbs`\n * The associated css should be at `app/templates/bar.css`\n * and the path passed to `scopedClass` should be `<modulePrefix>/templates/bar`\n *\n * @example\n * If a file is located at `<podModulePrefix>/bar/template.hbs`\n * The associated css should be at `app/<podModulePrefix sub path>/bar/styles.css`\n * and the path passed to `scopedClass` should be `<podModulePrefix>/bar`\n *\n */\nexport function scopedClass(className: string, modulePath: string): string;\n\nexport function scopedClass(\n ...args: [modulepath: string] | [className: string, modulePath: string]\n) {\n if (args.length === 1) {\n return hash(args[0]);\n }\n\n let [className, modulePath] = args;\n\n const postfix = hash(modulePath);\n\n return renameClass(className, postfix);\n}\n"],"mappings":";;;;;;;;;AA8BA,SAAS,QAAQ,GAAG,GAAG;CACrB,IAAI,OAAO,IAAI,UAAW,IAAI;AAG9B,SAFW,KAAK,OAAO,KAAK,OAAO,OAAO,OAE3B,KAAO,MAAM;;;;;;;;;AAU9B,SAAS,cAAc,KAAK,KAAK;AAC/B,QAAQ,OAAO,MAAQ,QAAS,KAAK;;;;;;;;;;;;;AAcvC,SAAS,OAAO,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG;AAChC,QAAO,QAAQ,cAAc,QAAQ,QAAQ,GAAG,EAAE,EA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nB,SAAO;GACP,CACD,KAAK,IAAI;AAOZ,QALmC,UAAU,QAC3C,UAAU,WAAW,CAAC,SAAS,EAC/B,eACD;;;;;ACqBH,SAAgB,YACd,GAAG,MACH;AACA,KAAI,KAAK,WAAW,EAClB,QAAO,KAAK,KAAK,GAAG;CAGtB,IAAI,CAAC,WAAW,cAAc;AAI9B,QAAO,YAAY,WAFH,KAAK,WAAW,CAEM"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ember-scoped-css",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -90,11 +90,7 @@ export const scopedCSS = (config) => (env, options, workingDirectory) => {
90
90
  }
91
91
 
92
92
  const original = path.node.arguments[0].value;
93
- const renamed = renameClass(
94
- original,
95
- state.postfix,
96
- new Set([original]),
97
- );
93
+ const renamed = renameClass(original, state.postfix);
98
94
  const transformedString = env.types.stringLiteral(renamed);
99
95
 
100
96
  path.replaceWith(transformedString);
@@ -0,0 +1,113 @@
1
+ import path from 'node:path';
2
+
3
+ import * as babel from '@babel/core';
4
+ import { describe, expect, it } from 'vitest';
5
+
6
+ import { hash } from '../lib/path/hash-from-module-path.js';
7
+ import { paths } from '../lib/path/utils.paths.test.js';
8
+ import { scopedCSS } from './babel-plugin.js';
9
+
10
+ const modulePath = 'vite-app/components/scoped-class-helper';
11
+ const postfix = hash(modulePath);
12
+ const filename = path.join(
13
+ paths.viteApp,
14
+ 'src/components/scoped-class-helper.js',
15
+ );
16
+
17
+ async function transform(code: string) {
18
+ const result = await babel.transformAsync(code, {
19
+ plugins: [[scopedCSS({}), {}]],
20
+ filename,
21
+ cwd: paths.viteApp,
22
+ root: paths.viteApp,
23
+ babelrc: false,
24
+ configFile: false,
25
+ });
26
+
27
+ return result?.code;
28
+ }
29
+
30
+ /** The value the `scopedClass(...)` call is replaced with. */
31
+ async function scopedClassOf(argument: string) {
32
+ const code = await transform(
33
+ [
34
+ `import { scopedClass } from 'ember-scoped-css';`,
35
+ `export const result = scopedClass(${argument});`,
36
+ ].join('\n'),
37
+ );
38
+
39
+ const match = code?.match(/export const result = "(.*)";/);
40
+
41
+ return match?.[1];
42
+ }
43
+
44
+ describe('scopedClass()', () => {
45
+ it('postfixes a single class', async () => {
46
+ expect(await scopedClassOf(`'bar-complete'`)).to.equal(
47
+ `bar-complete_${postfix}`,
48
+ );
49
+ });
50
+
51
+ it('postfixes every class of a multi-class argument', async () => {
52
+ expect(await scopedClassOf(`'column column-hidden'`)).to.equal(
53
+ `column_${postfix} column-hidden_${postfix}`,
54
+ );
55
+ });
56
+
57
+ it('postfixes every class regardless of how they are spaced', async () => {
58
+ // Leading and trailing whitespace survives; whitespace between classes
59
+ // collapses to a single space.
60
+ expect(await scopedClassOf(`' column column-hidden '`)).to.equal(
61
+ ` column_${postfix} column-hidden_${postfix} `,
62
+ );
63
+ });
64
+
65
+ it('agrees with the test-support helper, which the app asserts against', async () => {
66
+ const { scopedClass } = await import('../runtime/test-support.js');
67
+
68
+ expect(await scopedClassOf(`'column column-hidden'`)).to.equal(
69
+ scopedClass('column column-hidden', modulePath),
70
+ );
71
+ });
72
+
73
+ it('does not postfix a class twice', async () => {
74
+ expect(await scopedClassOf(`'bar-complete_${postfix}'`)).to.equal(
75
+ `bar-complete_${postfix}`,
76
+ );
77
+ });
78
+
79
+ it('removes the import', async () => {
80
+ const code = await transform(
81
+ [
82
+ `import { scopedClass } from 'ember-scoped-css';`,
83
+ `export const result = scopedClass('bar-complete');`,
84
+ ].join('\n'),
85
+ );
86
+
87
+ expect(code).to.not.include('ember-scoped-css');
88
+ });
89
+
90
+ describe('rejects arguments it cannot resolve at build time', () => {
91
+ it('throws on a dynamic argument', async () => {
92
+ await expect(
93
+ transform(
94
+ [
95
+ `import { scopedClass } from 'ember-scoped-css';`,
96
+ `export const result = scopedClass(someVariable);`,
97
+ ].join('\n'),
98
+ ),
99
+ ).rejects.toThrow(/only accepts a single, non-dynamic, string literal/);
100
+ });
101
+
102
+ it('throws on more than one argument', async () => {
103
+ await expect(
104
+ transform(
105
+ [
106
+ `import { scopedClass } from 'ember-scoped-css';`,
107
+ `export const result = scopedClass('column', 'column-hidden');`,
108
+ ].join('\n'),
109
+ ),
110
+ ).rejects.toThrow(/only accepts a single, non-dynamic, string literal/);
111
+ });
112
+ });
113
+ });
@@ -10,6 +10,11 @@ export function splitClassList(classList) {
10
10
  }
11
11
 
12
12
  /**
13
+ * Postfixes every class in `className`, which may be a space-separated list.
14
+ *
15
+ * `classesInCss` is consulted one class at a time, so it has to be keyed on
16
+ * individual class names — a Set built from a whole space-separated list
17
+ * matches nothing. Omit it to postfix every class unconditionally.
13
18
  *
14
19
  * @param {string} className
15
20
  * @param {string} postfix
@@ -1,24 +1,31 @@
1
1
  import { generateRuleTests, Rule } from 'ember-template-lint';
2
2
 
3
+ /**
4
+ * `scoped-class` is the legacy hbs global; `scopedClass` is the form consumers
5
+ * import. Both compile through the same build-time rewrite, so both are subject
6
+ * to the same restrictions.
7
+ */
8
+ const HELPER_NAMES = new Set(['scoped-class', 'scopedClass']);
9
+
3
10
  class ScopedClassHelperRule extends Rule {
4
11
  visitor() {
5
12
  const checkScopedClass = function (node) {
6
- if (node.path.original !== 'scoped-class') {
13
+ const helperName = node.path.original;
14
+
15
+ if (!HELPER_NAMES.has(helperName)) {
7
16
  return;
8
17
  }
9
18
 
10
19
  if (node.params.length === 1) {
11
20
  if (node.params[0].type !== 'StringLiteral') {
12
21
  this.log({
13
- message:
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',
22
+ message: `You cannot pass dynamic values to ${helperName} helper. {{${helperName} "some-class"}}. More info: https://github.com/soxhub/ember-scoped-css/blob/main/docs/lint-rules.md`,
15
23
  node,
16
24
  });
17
25
  }
18
26
  } else {
19
27
  this.log({
20
- message:
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',
28
+ message: `One positional param is required to be passed to ${helperName} helper. {{${helperName} "some-class"}}. More info: https://github.com/soxhub/ember-scoped-css/blob/main/docs/lint-rules.md`,
22
29
  node,
23
30
  });
24
31
  }
@@ -53,7 +60,13 @@ if (import.meta.vitest) {
53
60
  testMethod: it,
54
61
  plugins: [scopedClassHelperPlugin],
55
62
  config: true,
56
- good: ['{{scoped-class "test"}}', '{{(scoped-class "test")}}'],
63
+ good: [
64
+ '{{scoped-class "test"}}',
65
+ '{{(scoped-class "test")}}',
66
+ '{{scopedClass "test"}}',
67
+ '{{(scopedClass "test")}}',
68
+ '{{some-other-helper this.someClass}}',
69
+ ],
57
70
  bad: [
58
71
  {
59
72
  template: '{{scoped-class}}',
@@ -77,6 +90,61 @@ if (import.meta.vitest) {
77
90
  );
78
91
  },
79
92
  },
93
+ {
94
+ template: '{{scopedClass}}',
95
+
96
+ verifyResults(results) {
97
+ assert.equal(results.length, 1);
98
+ assert.equal(
99
+ results[0].message,
100
+ 'One positional param is required to be passed to scopedClass helper. {{scopedClass "some-class"}}. More info: https://github.com/soxhub/ember-scoped-css/blob/main/docs/lint-rules.md',
101
+ );
102
+ },
103
+ },
104
+ {
105
+ template: '{{scopedClass this.someClass}}',
106
+
107
+ verifyResults(results) {
108
+ assert.equal(results.length, 1);
109
+ assert.equal(
110
+ results[0].message,
111
+ 'You cannot pass dynamic values to scopedClass helper. {{scopedClass "some-class"}}. More info: https://github.com/soxhub/ember-scoped-css/blob/main/docs/lint-rules.md',
112
+ );
113
+ },
114
+ },
115
+ {
116
+ template: '{{scopedClass "first" "second"}}',
117
+
118
+ verifyResults(results) {
119
+ assert.equal(results.length, 1);
120
+ assert.equal(
121
+ results[0].message,
122
+ 'One positional param is required to be passed to scopedClass helper. {{scopedClass "some-class"}}. More info: https://github.com/soxhub/ember-scoped-css/blob/main/docs/lint-rules.md',
123
+ );
124
+ },
125
+ },
126
+ {
127
+ template: '<Foo @class={{scopedClass this.someClass}} />',
128
+
129
+ verifyResults(results) {
130
+ assert.equal(results.length, 1);
131
+ assert.equal(
132
+ results[0].message,
133
+ 'You cannot pass dynamic values to scopedClass helper. {{scopedClass "some-class"}}. More info: https://github.com/soxhub/ember-scoped-css/blob/main/docs/lint-rules.md',
134
+ );
135
+ },
136
+ },
137
+ {
138
+ template: '<Foo @class={{if x (scopedClass this.someClass)}} />',
139
+
140
+ verifyResults(results) {
141
+ assert.equal(results.length, 1);
142
+ assert.equal(
143
+ results[0].message,
144
+ 'You cannot pass dynamic values to scopedClass helper. {{scopedClass "some-class"}}. More info: https://github.com/soxhub/ember-scoped-css/blob/main/docs/lint-rules.md',
145
+ );
146
+ },
147
+ },
80
148
  ],
81
149
  });
82
150
  }