-
-
Notifications
You must be signed in to change notification settings - Fork 3
ember-cli-update to 6.11 #2532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
ember-cli-update to 6.11 #2532
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,6 @@ | |
|
|
||
| # compiled output | ||
| /dist/ | ||
| /declarations/ | ||
| /tmp/ | ||
|
|
||
| # dependencies | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -51,8 +51,8 @@ export default class HexInputComponent extends Component<HexInputSignature> { | |||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| @action | ||||||||||||||||||||||||||
| isComplete(buffer: Buffer, opts: { regex: string }): boolean { | ||||||||||||||||||||||||||
| return new RegExp(opts.regex).test(buffer.join('')); | ||||||||||||||||||||||||||
| isComplete(buffer: Array<string>, opts: { regex?: string }): boolean { | ||||||||||||||||||||||||||
| return new RegExp(opts.regex as string).test(buffer.join('')); | ||||||||||||||||||||||||||
|
Comment on lines
+54
to
+55
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's find and read the hex-input.gts file
find . -name "hex-input.gts" -type fRepository: shipshapecode/swach Length of output: 93 🏁 Script executed: # Also search for any references to ember-inputmask in the codebase
rg "ember-inputmask" --type ts --type js --type gts -A 3 -B 3Repository: shipshapecode/swach Length of output: 90 🏁 Script executed: # Check the package.json to confirm the version of ember-inputmask
cat package.json | grep -A 2 -B 2 "inputmask"Repository: shipshapecode/swach Length of output: 237 🏁 Script executed: # Read the hex-input.gts file to see the isComplete method
cat -n ./app/components/hex-input.gtsRepository: shipshapecode/swach Length of output: 3079 🏁 Script executed: # Search for isComplete usage in the codebase to understand how it's called
rg "isComplete" -g "*.gts" -g "*.ts" -g "*.js" -A 5 -B 5Repository: shipshapecode/swach Length of output: 3806 🌐 Web query:
💡 Result: In Inputmask (the library wrapped by
When you use the
The Inputmask docs/examples show $(selector).inputmask("Regex", {
regex: "[0-9]*",
isComplete: function (buffer, opts) {
return new RegExp(opts.regex).test(buffer.join(""));
}
});
``` [2]
**Sources:** [1] Type definitions for Inputmask options/signatures, including `isComplete(buffer, opts)` and `opts.regex`. [2] Inputmask documentation example showing `isComplete(buffer, opts)` using `opts.regex`.
---
🏁 Script executed:
```shell
# Let's verify the behavior of RegExp with undefined
node << 'EOF'
// Test what happens when RegExp is constructed with undefined
try {
const result = new RegExp(undefined);
console.log("RegExp(undefined):", result);
console.log("Test 'undefined' string:", result.test("undefined"));
console.log("Test other string:", result.test("hello"));
} catch (e) {
console.log("Error:", e.message);
}
EOFRepository: shipshapecode/swach Length of output: 142 Guard optional Line 55 force-casts an optional value ( Additionally, the type annotation declares Suggested fix- isComplete(buffer: Array<string>, opts: { regex?: string }): boolean {
- return new RegExp(opts.regex as string).test(buffer.join(''));
+ isComplete(buffer: Array<string>, opts: { regex?: string | RegExp }): boolean {
+ const pattern =
+ opts.regex instanceof RegExp
+ ? opts.regex
+ : opts.regex
+ ? new RegExp(opts.regex)
+ : this.hexRegex;
+
+ return pattern.test(buffer.join(''));
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,10 +76,10 @@ export default class RgbaInputComponent extends Component<RgbaInputSignature> { | |
| } | ||
|
|
||
| @action | ||
| isComplete(buffer: Buffer, opts: { regex: string }): boolean { | ||
| isComplete(buffer: Array<string>, opts: { regex?: string }): boolean { | ||
| const value = buffer.join(''); | ||
|
|
||
| return Boolean(value.length) && new RegExp(opts.regex).test(value); | ||
| return Boolean(value.length) && new RegExp(opts.regex as string).test(value); | ||
|
Comment on lines
+79
to
+82
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's locate and examine the file
find . -name "rgb-input.gts" -type fRepository: shipshapecode/swach Length of output: 93 🏁 Script executed: # Let's examine the rgb-input.gts file
cat -n ./app/components/rgb-input.gtsRepository: shipshapecode/swach Length of output: 4024 🏁 Script executed: # Let's check the ember-inputmask package.json or dependency info
find . -name "package.json" -type f -exec grep -l "ember-inputmask" {} \;Repository: shipshapecode/swach Length of output: 77 🏁 Script executed: # Let's check the package.json for ember-inputmask version
cat ./package.json | grep -A 2 -B 2 "ember-inputmask"Repository: shipshapecode/swach Length of output: 237 🌐 Web query:
💡 Result: In Inputmask v4.0.3 (which
Source
🌐 Web query:
💡 Result: In ember-inputmask, the Signature: isComplete(buffer, opts) { ... }
Example: <Inputmask
`@mask`="99/99/9999"
`@isComplete`={{(buffer, opts) => {
// opts.mask, opts.placeholder, opts.clearIncomplete, opts.alias, etc.
return buffer.join('').indexOf('_') === -1;
}}}
/>Sources: 🌐 Web query:
💡 Result: In Inputmask 4.x (including v4.0.3), the If you start with a const re = /^[0-9]*$/i;
$(el).inputmask("Regex", {
regex: re.source, // <- string
isComplete(buffer, opts) {
return new RegExp(opts.regex, re.flags).test(buffer.join(""));
}
});
Sources: [1] [2] 🏁 Script executed: # Let's search for other uses of isComplete in the codebase to understand the pattern
rg "isComplete" -A 3 -B 3Repository: shipshapecode/swach Length of output: 2341 🏁 Script executed: # Let's examine the alpha-input.gts to see how it implements isComplete
cat -n ./app/components/alpha-input.gts | sed -n '1,100p'Repository: shipshapecode/swach Length of output: 3154 Add fallback regex handling for optional The Suggested fix- isComplete(buffer: Array<string>, opts: { regex?: string }): boolean {
+ isComplete(buffer: Array<string>, opts: { regex?: string | RegExp }): boolean {
const value = buffer.join('');
-
- return Boolean(value.length) && new RegExp(opts.regex as string).test(value);
+ const pattern =
+ opts.regex instanceof RegExp
+ ? opts.regex
+ : opts.regex
+ ? new RegExp(opts.regex)
+ : this.rgbRegex;
+
+ return Boolean(value.length) && pattern.test(value);
}🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| /** | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: shipshapecode/swach
Length of output: 93
🏁 Script executed:
# Read the alpha-input.gts file to see the actual code cat -n app/components/alpha-input.gtsRepository: shipshapecode/swach
Length of output: 3154
🏁 Script executed:
Repository: shipshapecode/swach
Length of output: 90
🏁 Script executed:
Repository: shipshapecode/swach
Length of output: 1711
🏁 Script executed:
Repository: shipshapecode/swach
Length of output: 3231
🏁 Script executed:
Repository: shipshapecode/swach
Length of output: 2796
🏁 Script executed:
Repository: shipshapecode/swach
Length of output: 74
🏁 Script executed:
Repository: shipshapecode/swach
Length of output: 392
Fix type annotation and unsafe regex cast in completion validation.
The
optsparameter is typed as{ regex?: string }but receives aRegExpinstance (line 38). When casting as string withopts.regex as string, if regex were undefined,new RegExp(undefined)would create/(?:)/, matching any input unexpectedly.Update the type signature to accept
RegExp | string | undefined, and handle each case explicitly with a fallback tothis.alphaRegex:Suggested fix
Note: The same issue exists in
rgb-input.gts(line 79) andhex-input.gts(line 54).📝 Committable suggestion
🤖 Prompt for AI Agents