Unverified Commit ff0758d0 authored by Eric MORAND's avatar Eric MORAND Committed by GitHub
Browse files

Merge pull request #40 from ericmorand/issue-39

Resolve issue #39
parents f5fffa86 9c7906ff
Loading
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -5,9 +5,9 @@
  "scripts": {
    "build": "npm run clean && tsc",
    "clean": "rimraf dist",
    "test": "npm run build && ts-node node_modules/tape/bin/tape 'test/**/test.ts' | tap-bail | tap-spec",
    "test:unit": "ts-node node_modules/tape/bin/tape 'test/unit/**/test.ts' | tap-bail | tap-spec",
    "test:integration": "npm run build && ts-node node_modules/tape/bin/tape 'test/integration/**/test.ts' | tap-bail | tap-spec",
    "test": "npm run build && ts-node node_modules/tape/bin/tape 'test/**/test.ts' | tap-spec",
    "test:unit": "ts-node node_modules/tape/bin/tape 'test/unit/**/test.ts' | tap-spec",
    "test:integration": "npm run build && ts-node node_modules/tape/bin/tape 'test/integration/**/test.ts' | tap-spec",
    "cover": "rimraf .nyc_output coverage && nyc npm run test:unit",
    "coverage": "nyc report --reporter=text-lcov | coveralls",
    "prepack": "npm run build"
@@ -45,7 +45,7 @@
  "homepage": "https://github.com/NightlyCommit/twing-loader#readme",
  "description": "Webpack loader for Twig templates, based on Twing.",
  "dependencies": {
    "crypto-js": "^3.1.9-1",
    "crypto-js": "4.2.0",
    "loader-utils": "^1.2.3",
    "schema-utils": "^2.2.0",
    "slash": "^3.0.0"
@@ -54,6 +54,7 @@
    "@types/loader-utils": "^1.1.3",
    "@types/luxon": "^1.15.2",
    "@types/memory-fs": "^0.3.2",
    "@types/node": "^16.18.68",
    "@types/schema-utils": "^1.0.0",
    "@types/sinon": "^7.0.13",
    "@types/tape": "^4.2.33",
@@ -69,7 +70,7 @@
    "tap-spec": "^5.0.0",
    "tape": "^4.11.0",
    "ts-node": "^8.4.1",
    "twing": "^5.0.2",
    "twing": "^5.2.2",
    "typescript": "^3.6.3",
    "webpack": "^4.41.0",
    "webpack-cli": "^3.3.9"
+1 −1
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ module.exports = (context = {}) => {
        ]));

        environment.on('template', async (name: string, from: TwingSource) => {
            this.addDependency(await environment.getLoader().resolve(name, from));
            this.addDependency(await environment.getLoader().resolve(name, from, false));
        });

        environment.render(resourcePath, renderContext).then((result) => {
+5 −0
Original line number Diff line number Diff line
@@ -75,6 +75,11 @@ export class Visitor {
            await processExpressionNode(node.getNode('arguments').getNode(0));
        }

        // source function
        if ((node instanceof TwingNodeExpressionFunction) && (node.getAttribute('name') === 'source')) {
            await processExpressionNode(node.getNode('arguments').getNode(0));
        }

        // import and include tags
        if ((node instanceof TwingNodeImport) || (node instanceof TwingNodeInclude)) {
            if (node.hasNode('expr')) {
+1 −0
Original line number Diff line number Diff line
BAR
 No newline at end of file
+10 −0
Original line number Diff line number Diff line
let tpl = require('./index.twig');

if (typeof tpl === 'function') {
    tpl = tpl({
        foo: true,
        bar: false
    });
}

module.exports = tpl;
 No newline at end of file
Loading