@loopress/cli 0.32.0 → 0.32.1

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.
@@ -34,10 +34,8 @@ export function startsWithStrictTypes(content) {
34
34
  // Advances the brace depth and "a statement starts here" flag past one token; returns the token
35
35
  // when it starts a top-level statement that isn't a declaration.
36
36
  function step(state, token) {
37
- if (token.type === 'html') {
38
- state.atStart = true;
39
- return token.text === '' ? null : 'inline HTML after ?>';
40
- }
37
+ if (token.type === 'html')
38
+ return inlineHtml(state, token);
41
39
  const statementStart = state.depth === 0 && state.atStart;
42
40
  switch (token.text) {
43
41
  case ';': {
@@ -66,6 +64,13 @@ function step(state, token) {
66
64
  }
67
65
  }
68
66
  }
67
+ // A template inside a class or function body (`?> <p>...</p> <?php`) only runs when it is called.
68
+ function inlineHtml(state, token) {
69
+ if (state.depth > 0)
70
+ return null;
71
+ state.atStart = true;
72
+ return token.text === '' ? null : 'inline HTML after ?>';
73
+ }
69
74
  function openBrace(state, statementStart) {
70
75
  if (state.namespaceHeader) {
71
76
  state.namespaceHeader = false;