ripple 0.2.39 → 0.2.41
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
|
@@ -2,6 +2,7 @@ import * as acorn from 'acorn';
|
|
|
2
2
|
import { tsPlugin } from 'acorn-typescript';
|
|
3
3
|
import { parse_style } from './style.js';
|
|
4
4
|
import { walk } from 'zimmerframe';
|
|
5
|
+
import { regex_newline_characters } from '../../../utils/patterns.js';
|
|
5
6
|
|
|
6
7
|
const parser = acorn.Parser.extend(tsPlugin({ allowSatisfies: true }), RipplePlugin());
|
|
7
8
|
|
|
@@ -412,7 +413,9 @@ function RipplePlugin(config) {
|
|
|
412
413
|
}
|
|
413
414
|
} else {
|
|
414
415
|
if (open.name.name === 'style') {
|
|
415
|
-
|
|
416
|
+
// jsx_parseOpeningElementAt can treat a html element selector as an identifier and read it
|
|
417
|
+
// In that case, need to backtrack to include it in the css content
|
|
418
|
+
const start = this.pos - (this.value?.length ?? 1)
|
|
416
419
|
const input = this.input.slice(start);
|
|
417
420
|
const end = input.indexOf('</style>');
|
|
418
421
|
const content = input.slice(0, end);
|
|
@@ -423,7 +426,13 @@ function RipplePlugin(config) {
|
|
|
423
426
|
}
|
|
424
427
|
component.css = parse_style(content);
|
|
425
428
|
|
|
426
|
-
|
|
429
|
+
const newLines = content.match(regex_newline_characters)?.length;
|
|
430
|
+
if (newLines) {
|
|
431
|
+
this.curLine += newLines;
|
|
432
|
+
this.lineStart = start + content.lastIndexOf('\n') + 1;
|
|
433
|
+
}
|
|
434
|
+
this.pos = start + content.length + 1;
|
|
435
|
+
|
|
427
436
|
this.type = tok.jsxTagStart;
|
|
428
437
|
this.next();
|
|
429
438
|
if (this.value === '/') {
|
package/src/utils/patterns.js
CHANGED
|
@@ -12,6 +12,7 @@ export const regex_whitespaces_strict = /[ \t\n\r\f]+/g;
|
|
|
12
12
|
|
|
13
13
|
export const regex_only_whitespaces = /^[ \t\n\r\f]+$/;
|
|
14
14
|
|
|
15
|
+
export const regex_newline_characters = /\n/g;
|
|
15
16
|
export const regex_not_newline_characters = /[^\n]/g;
|
|
16
17
|
|
|
17
18
|
export const regex_is_valid_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
|