mirror of
https://github.com/harttle/liquidjs.git
synced 2026-10-03 09:05:14 -07:00
@@ -23,6 +23,7 @@
|
|||||||
"prefer-const": 2,
|
"prefer-const": 2,
|
||||||
"no-unused-vars": "off",
|
"no-unused-vars": "off",
|
||||||
"indent": "off",
|
"indent": "off",
|
||||||
|
"no-mixed-operators": "off",
|
||||||
"no-dupe-class-members": "off",
|
"no-dupe-class-members": "off",
|
||||||
"no-useless-constructor": "off",
|
"no-useless-constructor": "off",
|
||||||
"@typescript-eslint/indent": ["error", 2],
|
"@typescript-eslint/indent": ["error", 2],
|
||||||
|
|||||||
@@ -5,8 +5,19 @@ jobs:
|
|||||||
name: Test
|
name: Test
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest]
|
os: [ubuntu-latest]
|
||||||
timezone: [Etc/GMT, Asia/Shanghai, America/New_York]
|
timezone: [Etc/GMT, Asia/Shanghai, America/New_York]
|
||||||
|
node-version: [22]
|
||||||
|
include:
|
||||||
|
- os: macos-latest
|
||||||
|
timezone: America/New_York
|
||||||
|
node-versoin: 22
|
||||||
|
- os: ubuntu-latest
|
||||||
|
timezone: Etc/GMT
|
||||||
|
node-version: 16
|
||||||
|
- os: ubuntu-latest
|
||||||
|
timezone: Asia/Shanghai
|
||||||
|
node-version: 14
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -16,7 +27,7 @@ jobs:
|
|||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: ${{ matrix.node-version }}
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ const browserStream = {
|
|||||||
delimiters: ['', ''],
|
delimiters: ['', ''],
|
||||||
'./streamed-emitter': '../build/streamed-emitter-browser'
|
'./streamed-emitter': '../build/streamed-emitter-browser'
|
||||||
}
|
}
|
||||||
|
const browserPerf = {
|
||||||
|
include: ['./src/context/context.ts', './src/render/render.ts'],
|
||||||
|
'node:perf_hooks': '../build/perf_hooks-browser'
|
||||||
|
}
|
||||||
const esmRequire = {
|
const esmRequire = {
|
||||||
include: './src/fs/node.ts',
|
include: './src/fs/node.ts',
|
||||||
delimiters: ['', ''],
|
delimiters: ['', ''],
|
||||||
@@ -95,6 +99,7 @@ const browserEsm = {
|
|||||||
versionInjection,
|
versionInjection,
|
||||||
replace(browserFS),
|
replace(browserFS),
|
||||||
replace(browserStream),
|
replace(browserStream),
|
||||||
|
replace(browserPerf),
|
||||||
typescript(tsconfig('es6'))
|
typescript(tsconfig('es6'))
|
||||||
],
|
],
|
||||||
treeshake,
|
treeshake,
|
||||||
@@ -113,6 +118,7 @@ const browserUmd = {
|
|||||||
versionInjection,
|
versionInjection,
|
||||||
replace(browserFS),
|
replace(browserFS),
|
||||||
replace(browserStream),
|
replace(browserStream),
|
||||||
|
replace(browserPerf),
|
||||||
typescript(tsconfig('es5'))
|
typescript(tsconfig('es5'))
|
||||||
],
|
],
|
||||||
treeshake,
|
treeshake,
|
||||||
@@ -131,6 +137,7 @@ const browserMin = {
|
|||||||
versionInjection,
|
versionInjection,
|
||||||
replace(browserFS),
|
replace(browserFS),
|
||||||
replace(browserStream),
|
replace(browserStream),
|
||||||
|
replace(browserPerf),
|
||||||
typescript(tsconfig('es5')),
|
typescript(tsconfig('es5')),
|
||||||
uglify()
|
uglify()
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
const polyfill = {
|
||||||
|
now: () => Date.now()
|
||||||
|
}
|
||||||
|
|
||||||
|
export const performance = typeof window === 'object' && window.performance || polyfill
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import { Parser } from './parser'
|
||||||
|
import { Liquid, TokenKind } from '..'
|
||||||
|
|
||||||
|
describe('Parser', () => {
|
||||||
|
it('should coerce input to string', () => {
|
||||||
|
const parser = new Parser(new Liquid())
|
||||||
|
const templates = parser.parse({} as any)
|
||||||
|
expect(templates.length).toEqual(1)
|
||||||
|
expect(templates[0]).toMatchObject({
|
||||||
|
str: '[object Object]',
|
||||||
|
token: {
|
||||||
|
kind: TokenKind.HTML,
|
||||||
|
input: '[object Object]',
|
||||||
|
begin: 0,
|
||||||
|
end: 15
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
import { Liquid } from '../../src/liquid'
|
import { Drop, Liquid } from '../..'
|
||||||
import { Drop } from '../../src/drop/drop'
|
|
||||||
|
|
||||||
class SettingsDrop extends Drop {
|
class SettingsDrop extends Drop {
|
||||||
private foo = 'FOO'
|
public foo = 'FOO'
|
||||||
public bar () {
|
public bar () {
|
||||||
return 'BAR'
|
return 'BAR'
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user