diff --git a/npm-audit.html b/npm-audit.html index 4c1d8ae..3f23064 100644 --- a/npm-audit.html +++ b/npm-audit.html @@ -55,7 +55,7 @@
- November 15th 2020, 6:31:49 pm + December 3rd 2020, 4:40:36 am

Last updated

diff --git a/package-lock.json b/package-lock.json index d89af9b..7707db9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,13 +23,13 @@ } }, "@adonisjs/require-ts": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@adonisjs/require-ts/-/require-ts-1.1.0.tgz", - "integrity": "sha512-GIOQR9/7UEcYMEnfHThpsOcyfbJqPIHEAgYjW4wQhi60lSuB3uGFbmquk6F8aLw4fj+1QKOSlVLirdduQjQ4Dg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@adonisjs/require-ts/-/require-ts-1.1.1.tgz", + "integrity": "sha512-TCy4MPB26nCpPkSzBKy1ijSwcO/TRzjEf2Cf1WQ+3/UpSXDfKScSelrWdXUc9J9n06Ws7FQpY0aAsad7rrH9ew==", "dev": true, "requires": { - "@poppinss/utils": "^2.5.7", - "debug": "^4.2.0", + "@poppinss/utils": "^2.5.9", + "debug": "^4.3.1", "find-cache-dir": "^3.3.1", "fs-extra": "^9.0.1", "normalize-path": "^3.0.0", @@ -39,9 +39,9 @@ }, "dependencies": { "debug": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", - "integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "dev": true, "requires": { "ms": "2.1.2" @@ -336,9 +336,9 @@ "integrity": "sha512-kLeEaBSGhlleyYvKc7c9s3uE6xv7cwyulE0EgHf4jU/CL96h0yC4mkdw1wvC1l1PYYQozCGy46FwMBAAMOobCA==" }, "@poppinss/utils": { - "version": "2.5.7", - "resolved": "https://registry.npmjs.org/@poppinss/utils/-/utils-2.5.7.tgz", - "integrity": "sha512-O2Qjz+iIRTIJAwwH/bOml9nj4/kszcpoEyNoeir1KhxsyXhstnHNeTK9FsMlJz38JOs1y1h/tAP3qkkEHlTMkg==", + "version": "2.5.9", + "resolved": "https://registry.npmjs.org/@poppinss/utils/-/utils-2.5.9.tgz", + "integrity": "sha512-TdUGqPfMwwVvzFXdWx/VmwGcniVgFqPFhk8vAim+/mlu6WAzv5EeGDpoZCHiL4D2cMOBY2plBV4EoKUgqeBL+g==", "requires": { "buffer-alloc": "^1.2.0", "fast-safe-stringify": "^2.0.7", @@ -520,9 +520,9 @@ "dev": true }, "@types/node": { - "version": "14.14.7", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.7.tgz", - "integrity": "sha512-Zw1vhUSQZYw+7u5dAwNbIA9TuTotpzY/OF7sJM9FqPOF3SPjKnxrjoTktXDZgUjybf4cWVBP7O8wvKdSaGHweg==", + "version": "14.14.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.10.tgz", + "integrity": "sha512-J32dgx2hw8vXrSbu4ZlVhn1Nm3GbeCFNw2FWL8S5QKucHGY0cyNwjdQdO+KMBZ4wpmC7KhLCiNsdk1RFRIYUQQ==", "dev": true }, "@types/normalize-package-data": { @@ -2184,22 +2184,22 @@ "integrity": "sha512-PnH9+S4e5eSyUFjGx71GAN41sI4eoXbj4pEOfUNFpMDaPlLWdfjQbGP46is2C/1ZLdRQFpN8lMIpAEY49aU3gg==" }, "edge-lexer": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/edge-lexer/-/edge-lexer-3.2.0.tgz", - "integrity": "sha512-KCXSzj4mH4vebHyDwesQ5OxIjdNP1iRa8o2lH7NrMPPQnzdDs7CldrJGwH5uEuE0zSasnHGg4+M4zgF8tOw5kQ==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/edge-lexer/-/edge-lexer-3.2.1.tgz", + "integrity": "sha512-3fMuS1peObug+WsKC+vWN40Zi/G7Zx2hbVCrmafpVVl1udNV4MmNi1BpwGdW4G9U9QtzrsOLPk/3SPgOcpY6fg==", "requires": { "edge-error": "^1.0.5" } }, "edge-parser": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/edge-parser/-/edge-parser-5.4.0.tgz", - "integrity": "sha512-ZOuygGoK2B2xwz3JzdLsUUQoIM5494IK9CmMOi1y9ZZFgijEdP3g+J4IiwGF/rUK0hnx83t/UNQgHmahalPIyw==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/edge-parser/-/edge-parser-6.0.0.tgz", + "integrity": "sha512-98uUD3h07TtfubE0WfEneFMpVh2Bhf3pO4dn3CzcCCxdYNVhqGzIK/UsAt7Fd1A/XNKqANmk6/QxmtJJVtEkCw==", "requires": { "acorn": "^8.0.4", "astring": "^1.4.3", "edge-error": "^1.0.5", - "edge-lexer": "^3.2.0", + "edge-lexer": "^3.2.1", "js-stringify": "^1.0.2" } }, @@ -2286,9 +2286,9 @@ "dev": true }, "eslint": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.13.0.tgz", - "integrity": "sha512-uCORMuOO8tUzJmsdRtrvcGq5qposf7Rw0LwkTJkoDbOycVQtQjmnhZSuLQnozLE4TmAzlMVV45eCHmQ1OpDKUQ==", + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.14.0.tgz", + "integrity": "sha512-5YubdnPXrlrYAFCKybPuHIAH++PINe1pmKNc5wQRB9HSbqIK1ywAnntE3Wwua4giKu0bjligf1gLF6qxMGOYRA==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -2352,17 +2352,35 @@ "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", "dev": true }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, "semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", - "dev": true + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } }, "strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true } } }, @@ -2992,6 +3010,12 @@ "homedir-polyfill": "^1.0.0" } }, + "git-default-branch": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/git-default-branch/-/git-default-branch-1.0.0.tgz", + "integrity": "sha512-/eBj13g+SDiPnRMO82wTCA6P0Xi413TWSeyjf5Qj/vdLzn7iXROotuElMF4fNxNlL7TMbUjUW1EHjd3E9OAItQ==", + "dev": true + }, "git-user-email": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/git-user-email/-/git-user-email-0.2.2.tgz", @@ -4862,9 +4886,9 @@ "dev": true }, "mrm": { - "version": "2.5.12", - "resolved": "https://registry.npmjs.org/mrm/-/mrm-2.5.12.tgz", - "integrity": "sha512-4oqltDHL0KueUCeI1jhtuhYIkul7lLi21vgskS9QYdwh0o9wST3zHa/jD875wu9f9HqKSa7FOOd9G5sZYW0vsA==", + "version": "2.5.13", + "resolved": "https://registry.npmjs.org/mrm/-/mrm-2.5.13.tgz", + "integrity": "sha512-vdiOrOnCvjjcQsRdzkPxLWyaJVF+5o61ikxdfiFIubUDySItbvyRsRUsLLVuAtWJWMuEQGmH57B0ijoMV2q8Sg==", "dev": true, "requires": { "cross-spawn": "7.0.3", @@ -4879,7 +4903,7 @@ "middleearth-names": "^1.1.0", "minimist": "^1.2.0", "mrm-core": "^4.3.0", - "mrm-preset-default": "^2.3.3", + "mrm-preset-default": "^2.3.4", "package-json": "6.5.0", "requireg": "^0.2.2", "semver-utils": "^1.1.4", @@ -4965,14 +4989,14 @@ } }, "mrm-preset-default": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/mrm-preset-default/-/mrm-preset-default-2.3.3.tgz", - "integrity": "sha512-hRwwEcgxBk1MyaMGT1dm4SvNuuVbR0OCuM5XJiJufgJ7mHewDx1gFB4eKDWBamSDuAVKfdfyPmczGrGeUZb+Iw==", + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/mrm-preset-default/-/mrm-preset-default-2.3.4.tgz", + "integrity": "sha512-Qw4mGroD/17+DwuCdNKgEJEAMS3RDC0MIFUYGsMJ+1O0x3Q93KIqstbhN7H+Q1uL0WcpGGhMfHp7CI2aVSwfTQ==", "dev": true, "requires": { "mrm-core": "^4.3.0", - "mrm-task-ci": "^0.2.0", - "mrm-task-codecov": "^2.1.3", + "mrm-task-ci": "^0.2.1", + "mrm-task-codecov": "^3.0.0", "mrm-task-contributing": "^2.0.13", "mrm-task-dependabot": "^1.2.3", "mrm-task-editorconfig": "^2.0.13", @@ -4986,8 +5010,8 @@ "mrm-task-readme": "^2.1.1", "mrm-task-semantic-release": "^4.0.1", "mrm-task-styleguidist": "^2.0.11", - "mrm-task-stylelint": "^3.0.11", - "mrm-task-travis": "^2.0.11", + "mrm-task-stylelint": "^3.0.12", + "mrm-task-travis": "^2.1.0", "mrm-task-typescript": "^2.0.11" }, "dependencies": { @@ -5038,11 +5062,12 @@ } }, "mrm-task-ci": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/mrm-task-ci/-/mrm-task-ci-0.2.0.tgz", - "integrity": "sha512-2epXOdXIkTpOr/ZoW2IKQGYIAAWr2nv1yBT3fDXI8Qw7uBa3Vtm8+b8K0anRtPGaEp+3hCytUOeq1ZvNmaBQ3Q==", + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/mrm-task-ci/-/mrm-task-ci-0.2.1.tgz", + "integrity": "sha512-cRMw+jlAtLKowvg9Rm9K9olDmoKJSmnGoVhoE6ABhfB3uLY8Inv8yGCnUf97y+vLOCaMSnUjIF68Su0PRNTzHA==", "dev": true, "requires": { + "git-default-branch": "^1.0.0", "got": "^11.8.0", "lodash": "^4.17.20", "mrm-core": "^4.3.0", @@ -5111,13 +5136,14 @@ } }, "mrm-task-codecov": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/mrm-task-codecov/-/mrm-task-codecov-2.1.3.tgz", - "integrity": "sha512-Fcz4e6AwahEBNek9s457wYqRT2LwPQS59CA+2ReOrsxp3QxAjTTg9VtMUTfBvd9U0h7jCJyy/0hVV20WFotgvA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mrm-task-codecov/-/mrm-task-codecov-3.0.0.tgz", + "integrity": "sha512-nfnt2wtLsT/8LzTXGI9SV+R7pIGaWuunoELOpIdADGiiR2YxvNfIsEBMFw7/SF+0Zs+UJ6xeRMeBG571dN/yAg==", "dev": true, "requires": { - "git-username": "^1.0.0", - "mrm-core": "^4.3.0" + "git-default-branch": "^1.0.0", + "mrm-core": "^4.3.0", + "package-repo-url": "^1.0.3" }, "dependencies": { "mrm-core": { @@ -5706,9 +5732,9 @@ } }, "mrm-task-stylelint": { - "version": "3.0.11", - "resolved": "https://registry.npmjs.org/mrm-task-stylelint/-/mrm-task-stylelint-3.0.11.tgz", - "integrity": "sha512-aJgIaLgpMYPdEg/LnGIDfd0WuOAdAaw4NmW5Cs7p967jTEVHbYbyb7uCA101DJUIe3m7UeSmE+hcH4vpbQ39Wg==", + "version": "3.0.12", + "resolved": "https://registry.npmjs.org/mrm-task-stylelint/-/mrm-task-stylelint-3.0.12.tgz", + "integrity": "sha512-cELN4nVbF7nYjSBtMSiW2AaR6HTat+5kEoN3pmgodV8MRug/N2WHWWMoiMScxshoPmmgkRii6KkalOySM2BZdg==", "dev": true, "requires": { "mrm-core": "^4.3.0" @@ -5750,14 +5776,14 @@ } }, "mrm-task-travis": { - "version": "2.0.11", - "resolved": "https://registry.npmjs.org/mrm-task-travis/-/mrm-task-travis-2.0.11.tgz", - "integrity": "sha512-HshBTEII7bs4yWkSa22geW94gaT+u7kJQ+jKXR9JyABxur9yBLM1kNZ03LvCgMMFR/0r65ZlAG5BDasWp827jw==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mrm-task-travis/-/mrm-task-travis-2.1.0.tgz", + "integrity": "sha512-M1dxwAd7hqE5eOQ8tF06+C4RRAdh87Bi/hSeIqe/RUyInr33a7u+CQ2quBjI1Ki/NVvI6I7oF9YCRi5/ok3gbA==", "dev": true, "requires": { - "git-username": "^1.0.0", "lodash": "^4.17.15", "mrm-core": "^4.3.0", + "package-repo-url": "^1.0.3", "semver-utils": "^1.1.4" }, "dependencies": { @@ -6935,9 +6961,9 @@ "dev": true }, "prettier": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.2.tgz", - "integrity": "sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", "dev": true }, "prettier-linter-helpers": { @@ -8262,9 +8288,9 @@ } }, "typescript": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.5.tgz", - "integrity": "sha512-ywmr/VrTVCmNTJ6iV2LwIrfG1P+lv6luD8sUJs+2eI9NLGigaN+nUQc13iHqisq7bra9lnmUSYqbJvegraBOPQ==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.2.tgz", + "integrity": "sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ==", "dev": true }, "uglify-js": { diff --git a/package.json b/package.json index a97f345..726866b 100644 --- a/package.json +++ b/package.json @@ -35,15 +35,15 @@ "homepage": "https://github.com/poppinss/edge#readme", "devDependencies": { "@adonisjs/mrm-preset": "^2.4.0", - "@adonisjs/require-ts": "^1.1.0", + "@adonisjs/require-ts": "^1.1.1", "@poppinss/dev-utils": "^1.0.11", - "@types/node": "^14.14.7", + "@types/node": "^14.14.10", "commitizen": "^4.2.2", "cz-conventional-changelog": "^3.3.0", "dedent-js": "^1.0.1", "del-cli": "^3.0.1", "doctoc": "^1.4.0", - "eslint": "^7.13.0", + "eslint": "^7.14.0", "eslint-config-prettier": "^6.15.0", "eslint-plugin-adonis": "^1.0.15", "eslint-plugin-prettier": "^3.1.4", @@ -51,11 +51,11 @@ "husky": "^4.3.0", "japa": "^3.1.1", "js-stringify": "^1.0.2", - "mrm": "^2.5.12", + "mrm": "^2.5.13", "np": "^7.0.0", "npm-audit-html": "^1.5.0", - "prettier": "^2.1.2", - "typescript": "^4.0.5" + "prettier": "^2.2.1", + "typescript": "^4.1.2" }, "config": { "commitizen": { @@ -72,10 +72,10 @@ }, "dependencies": { "@poppinss/inspect": "^1.0.1", - "@poppinss/utils": "^2.5.7", + "@poppinss/utils": "^2.5.9", "edge-error": "^1.0.5", - "edge-lexer": "^3.2.0", - "edge-parser": "^5.4.0", + "edge-lexer": "^3.2.1", + "edge-parser": "^6.0.0", "he": "^1.2.0", "lodash.foreach": "^4.5.0", "lodash.merge": "^4.6.2", diff --git a/src/Compiler/index.ts b/src/Compiler/index.ts index e204674..39e1009 100644 --- a/src/Compiler/index.ts +++ b/src/Compiler/index.ts @@ -129,9 +129,7 @@ export class Compiler implements CompilerContract { * merged together. */ private templateContentToTokens(content: string, parser: Parser, absPath: string): Token[] { - let templateTokens = parser.tokenize(content, absPath, (line) => - this.processor.executeLine(line) - ) + let templateTokens = parser.tokenize(content, { filename: absPath }) const firstToken = templateTokens[0] /** diff --git a/src/Processor/index.ts b/src/Processor/index.ts index 88938e6..3ab03b5 100644 --- a/src/Processor/index.ts +++ b/src/Processor/index.ts @@ -99,7 +99,6 @@ export class Processor implements ProcessorContract { event: 'raw', handler: (data: { raw: string; path: string }) => string | void ): this - public process(event: 'line', handler: (line: string) => string | void): this public process( event: 'compiled', handler: (data: { compiled: string; path: string }) => string | void diff --git a/test/compiler.spec.ts b/test/compiler.spec.ts index 87edb30..2c2a9a8 100644 --- a/test/compiler.spec.ts +++ b/test/compiler.spec.ts @@ -1119,100 +1119,4 @@ test.group('Compiler | Processor', (group) => { `) ) }) - - test('execute line processor function', async (assert) => { - assert.plan(2) - - await fs.add( - 'index.edge', - dedent` - Hello - world - ` - ) - - const loader = new Loader() - loader.mount('default', fs.basePath) - - const processor = new Processor() - let lineNumber = 0 - - processor.process('line', (line) => { - lineNumber++ - if (lineNumber === 1) { - assert.equal(line, 'Hello') - } - - if (lineNumber === 2) { - assert.equal(line, 'world') - } - }) - - const compiler = new Compiler( - loader, - { - section: sectionTag, - layout: layoutTag, - }, - processor - ) - - compiler.compile('index') - }) - - test('use return value of the template', async (assert) => { - assert.plan(3) - - await fs.add( - 'index.edge', - dedent` - Hello - world - ` - ) - - const loader = new Loader() - loader.mount('default', fs.basePath) - - const processor = new Processor() - let lineNumber = 0 - - processor.process('line', (line) => { - lineNumber++ - if (lineNumber === 1) { - assert.equal(line, 'Hello') - return 'hi' - } - - if (lineNumber === 2) { - assert.equal(line, 'world') - return 'universe' - } - }) - - const compiler = new Compiler( - loader, - { - section: sectionTag, - layout: layoutTag, - }, - processor - ) - - assert.stringEqual( - compiler.compile('index.edge').template, - normalizeNewLines(dedent`let out = ""; - let $lineNumber = 1; - let $filename = ${stringify(join(fs.basePath, 'index.edge'))}; - try { - out += "hi"; - out += "\\n"; - out += "universe"; - } catch (error) { - ctx.reThrow(error, $filename, $lineNumber); - } - return out; - `) - ) - }) })