Skip to content

Commit

Permalink
fix(#108): remove absolute path in emitted d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
harttle committed Feb 25, 2019
1 parent 75b3e15 commit 53a835a
Show file tree
Hide file tree
Showing 103 changed files with 275 additions and 343 deletions.
6 changes: 3 additions & 3 deletions benchmark/demo.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as Benchmark from 'benchmark'
import Liquid from 'src/liquid'
import TagToken from 'src/parser/tag-token'
import Scope from 'src/scope/scope'
import Liquid from '../src/liquid'
import TagToken from '../src/parser/tag-token'
import Scope from '../src/scope/scope'

const engine = new Liquid({
root: __dirname,
Expand Down
2 changes: 1 addition & 1 deletion demo/typescript/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Liquid from '../../dist/liquid.js'
import Liquid from 'liquidjs'

const engine = new Liquid({
root: __dirname,
Expand Down
4 changes: 2 additions & 2 deletions libs.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
declare module 'rollup-plugin-uglify' {
export function uglify (): any
}
declare module 'rollup-plugin-shim' {
export default function shim(options: any): any
declare module 'rollup-plugin-alias' {
export default function alias(options: any): any
}
49 changes: 8 additions & 41 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,14 @@
"nyc": "^13.1.0",
"regenerator-runtime": "^0.12.1",
"rollup": "^1.1.2",
"rollup-plugin-shim": "^1.0.0",
"rollup-plugin-alias": "^1.5.1",
"rollup-plugin-typescript2": "^0.19.2",
"rollup-plugin-uglify": "^6.0.2",
"semantic-release": "^15.13.3",
"sinon": "^7.2.3",
"sinon-chai": "^3.3.0",
"supertest": "^3.4.2",
"ts-node": "^8.0.2",
"tsconfig-paths": "^3.8.0",
"tslib": "^1.9.3",
"typescript": "^3.3.3"
},
Expand Down
15 changes: 6 additions & 9 deletions rollup.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import shim from 'rollup-plugin-shim'
import alias from 'rollup-plugin-alias'
import { uglify } from 'rollup-plugin-uglify'
import pkg from './package.json'
import typescript from 'rollup-plugin-typescript2'

const fake = { fs: `export default {}`, path: `export default {}` }
const version = process.env.VERSION || pkg.version
const sourcemap = true
const banner = `/*
Expand All @@ -14,7 +13,7 @@ const banner = `/*
const treeshake = {
propertyReadSideEffects: false
}
const input = 'src/liquid.ts'
const input = './src/liquid.ts'

export default [{
output: [{
Expand Down Expand Up @@ -46,15 +45,14 @@ export default [{
banner
}],
plugins: [
shim(fake),
alias({ resolve: ['.ts'], './fs/node': './fs/browser' }),
typescript({
tsconfigOverride: {
include: [ 'src' ],
exclude: [ 'test', 'benchmark' ],
compilerOptions: {
target: 'es5',
module: 'ES2015',
paths: { 'src/fs': ['src/fs/browser'] }
module: 'ES2015'
}
}
})
Expand All @@ -69,15 +67,14 @@ export default [{
sourcemap
}],
plugins: [
shim(fake),
alias({ resolve: ['.ts'], './fs/node': './fs/browser' }),
typescript({
tsconfigOverride: {
include: [ 'src' ],
exclude: [ 'test', 'benchmark' ],
compilerOptions: {
target: 'es5',
module: 'ES2015',
paths: { 'src/fs': ['src/fs/browser'] }
module: 'ES2015'
}
}
}),
Expand Down
2 changes: 1 addition & 1 deletion src/builtin/filters/array.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { last } from 'src/util/underscore'
import { last } from '../../util/underscore'

export default {
'join': (v: any[], arg: string) => v.join(arg === undefined ? ' ' : arg),
Expand Down
4 changes: 2 additions & 2 deletions src/builtin/filters/date.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import strftime from 'src/util/strftime'
import { isString } from 'src/util/underscore'
import strftime from '../../util/strftime'
import { isString } from '../../util/underscore'

export default {
'date': (v: string | Date, arg: string) => {
Expand Down
2 changes: 1 addition & 1 deletion src/builtin/filters/object.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isTruthy } from 'src/render/syntax'
import { isTruthy } from '../../render/syntax'

export default {
'default': <T1, T2>(v: T1, arg: T2): T1 | T2 => isTruthy(v) ? v : arg
Expand Down
2 changes: 1 addition & 1 deletion src/builtin/filters/string.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FilterImpl } from 'src/template/filter/filter-impl'
import { FilterImpl } from '../../template/filter/filter-impl'

export default {
'append': (v: string, arg: string) => v + arg,
Expand Down
12 changes: 6 additions & 6 deletions src/builtin/tags/assign.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'src/util/assert'
import { identifier } from 'src/parser/lexical'
import { AssignScope } from 'src/scope/scopes'
import TagToken from 'src/parser/tag-token'
import Scope from 'src/scope/scope'
import ITagImplOptions from 'src/template/tag/itag-impl-options'
import assert from '../../util/assert'
import { identifier } from '../../parser/lexical'
import { AssignScope } from '../../scope/scopes'
import TagToken from '../../parser/tag-token'
import Scope from '../../scope/scope'
import ITagImplOptions from '../../template/tag/itag-impl-options'

const re = new RegExp(`(${identifier.source})\\s*=([^]*)`)

Expand Down
14 changes: 7 additions & 7 deletions src/builtin/tags/block.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import BlockMode from 'src/scope/block-mode'
import TagToken from 'src/parser/tag-token'
import Token from 'src/parser/token'
import ITemplate from 'src/template/itemplate'
import Scope from 'src/scope/scope'
import ITagImplOptions from 'src/template/tag/itag-impl-options'
import ParseStream from 'src/parser/parse-stream'
import BlockMode from '../../scope/block-mode'
import TagToken from '../../parser/tag-token'
import Token from '../../parser/token'
import ITemplate from '../../template/itemplate'
import Scope from '../../scope/scope'
import ITagImplOptions from '../../template/tag/itag-impl-options'
import ParseStream from '../../parser/parse-stream'

export default {
parse: function (token: TagToken, remainTokens: Token[]) {
Expand Down
2 changes: 1 addition & 1 deletion src/builtin/tags/break.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RenderBreakError } from 'src/util/error'
import { RenderBreakError } from '../../util/error'

export default {
render: async function () {
Expand Down
14 changes: 7 additions & 7 deletions src/builtin/tags/capture.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import assert from 'src/util/assert'
import { identifier } from 'src/parser/lexical'
import { CaptureScope } from 'src/scope/scopes'
import TagToken from 'src/parser/tag-token'
import Token from 'src/parser/token'
import Scope from 'src/scope/scope'
import ITagImplOptions from 'src/template/tag/itag-impl-options'
import assert from '../../util/assert'
import { identifier } from '../../parser/lexical'
import { CaptureScope } from '../../scope/scopes'
import TagToken from '../../parser/tag-token'
import Token from '../../parser/token'
import Scope from '../../scope/scope'
import ITagImplOptions from '../../template/tag/itag-impl-options'

const re = new RegExp(`(${identifier.source})`)

Expand Down
14 changes: 7 additions & 7 deletions src/builtin/tags/case.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { evalExp } from 'src/render/syntax'
import TagToken from 'src/parser/tag-token'
import Token from 'src/parser/token'
import Scope from 'src/scope/scope'
import ITemplate from 'src/template/itemplate'
import ITagImplOptions from 'src/template/tag/itag-impl-options'
import ParseStream from 'src/parser/parse-stream'
import { evalExp } from '../../render/syntax'
import TagToken from '../../parser/tag-token'
import Token from '../../parser/token'
import Scope from '../../scope/scope'
import ITemplate from '../../template/itemplate'
import ITagImplOptions from '../../template/tag/itag-impl-options'
import ParseStream from '../../parser/parse-stream'

export default {
parse: function (tagToken: TagToken, remainTokens: Token[]) {
Expand Down
6 changes: 3 additions & 3 deletions src/builtin/tags/comment.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import TagToken from 'src/parser/tag-token'
import Token from 'src/parser/token'
import ITagImplOptions from 'src/template/tag/itag-impl-options'
import TagToken from '../../parser/tag-token'
import Token from '../../parser/token'
import ITagImplOptions from '../../template/tag/itag-impl-options'

export default {
parse: function (tagToken: TagToken, remainTokens: Token[]) {
Expand Down
2 changes: 1 addition & 1 deletion src/builtin/tags/continue.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RenderBreakError } from 'src/util/error'
import { RenderBreakError } from '../../util/error'

export default {
render: async function () {
Expand Down
12 changes: 6 additions & 6 deletions src/builtin/tags/cycle.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'src/util/assert'
import { value as rValue } from 'src/parser/lexical'
import { evalValue } from 'src/render/syntax'
import TagToken from 'src/parser/tag-token'
import Scope from 'src/scope/scope'
import ITagImplOptions from 'src/template/tag/itag-impl-options'
import assert from '../../util/assert'
import { value as rValue } from '../../parser/lexical'
import { evalValue } from '../../render/syntax'
import TagToken from '../../parser/tag-token'
import Scope from '../../scope/scope'
import ITagImplOptions from '../../template/tag/itag-impl-options'

const groupRE = new RegExp(`^(?:(${rValue.source})\\s*:\\s*)?(.*)$`)
const candidatesRE = new RegExp(rValue.source, 'g')
Expand Down
12 changes: 6 additions & 6 deletions src/builtin/tags/decrement.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import assert from 'src/util/assert'
import { identifier } from 'src/parser/lexical'
import { CaptureScope, AssignScope, DecrementScope } from 'src/scope/scopes'
import TagToken from 'src/parser/tag-token'
import Scope from 'src/scope/scope'
import ITagImplOptions from 'src/template/tag/itag-impl-options'
import assert from '../../util/assert'
import { identifier } from '../../parser/lexical'
import { CaptureScope, AssignScope, DecrementScope } from '../../scope/scopes'
import TagToken from '../../parser/tag-token'
import Scope from '../../scope/scope'
import ITagImplOptions from '../../template/tag/itag-impl-options'

export default {
parse: function (token: TagToken) {
Expand Down
24 changes: 12 additions & 12 deletions src/builtin/tags/for.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { mapSeries } from 'src/util/promise'
import { isString, isObject, isArray } from 'src/util/underscore'
import { evalExp } from 'src/render/syntax'
import assert from 'src/util/assert'
import { identifier, value, hash } from 'src/parser/lexical'
import TagToken from 'src/parser/tag-token'
import Token from 'src/parser/token'
import Scope from 'src/scope/scope'
import Hash from 'src/template/tag/hash'
import ITemplate from 'src/template/itemplate'
import ITagImplOptions from 'src/template/tag/itag-impl-options'
import ParseStream from 'src/parser/parse-stream'
import { mapSeries } from '../../util/promise'
import { isString, isObject, isArray } from '../../util/underscore'
import { evalExp } from '../../render/syntax'
import assert from '../../util/assert'
import { identifier, value, hash } from '../../parser/lexical'
import TagToken from '../../parser/tag-token'
import Token from '../../parser/token'
import Scope from '../../scope/scope'
import Hash from '../../template/tag/hash'
import ITemplate from '../../template/itemplate'
import ITagImplOptions from '../../template/tag/itag-impl-options'
import ParseStream from '../../parser/parse-stream'

const re = new RegExp(`^(${identifier.source})\\s+in\\s+` +
`(${value.source})` +
Expand Down
14 changes: 7 additions & 7 deletions src/builtin/tags/if.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { evalExp, isTruthy } from 'src/render/syntax'
import TagToken from 'src/parser/tag-token'
import Token from 'src/parser/token'
import Scope from 'src/scope/scope'
import ITemplate from 'src/template/itemplate'
import ITagImplOptions from 'src/template/tag/itag-impl-options'
import ParseStream from 'src/parser/parse-stream'
import { evalExp, isTruthy } from '../../render/syntax'
import TagToken from '../../parser/tag-token'
import Token from '../../parser/token'
import Scope from '../../scope/scope'
import ITemplate from '../../template/itemplate'
import ITagImplOptions from '../../template/tag/itag-impl-options'
import ParseStream from '../../parser/parse-stream'

export default {
parse: function (tagToken: TagToken, remainTokens: Token[]) {
Expand Down
16 changes: 8 additions & 8 deletions src/builtin/tags/include.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import assert from 'src/util/assert'
import { value, quotedLine } from 'src/parser/lexical'
import { evalValue } from 'src/render/syntax'
import BlockMode from 'src/scope/block-mode'
import TagToken from 'src/parser/tag-token'
import Scope from 'src/scope/scope'
import Hash from 'src/template/tag/hash'
import ITagImplOptions from 'src/template/tag/itag-impl-options'
import assert from '../../util/assert'
import { value, quotedLine } from '../../parser/lexical'
import { evalValue } from '../../render/syntax'
import BlockMode from '../../scope/block-mode'
import TagToken from '../../parser/tag-token'
import Scope from '../../scope/scope'
import Hash from '../../template/tag/hash'
import ITagImplOptions from '../../template/tag/itag-impl-options'

const staticFileRE = /[^\s,]+/
const withRE = new RegExp(`with\\s+(${value.source})`)
Expand Down

0 comments on commit 53a835a

Please sign in to comment.