9 Commits

Author SHA1 Message Date
49aa80aca8 2.0.9 2022-07-24 15:30:20 +02:00
b382256cc7 fix(core): update 2022-07-24 15:30:19 +02:00
97400fa501 2.0.8 2019-09-10 18:14:36 +02:00
914a8eafce fix(core): update 2019-09-10 18:14:36 +02:00
7299b3a9c6 2.0.7 2019-09-10 18:03:24 +02:00
cfd257d359 fix(core): update 2019-09-10 18:03:24 +02:00
203ea05f67 2.0.6 2019-09-10 18:02:43 +02:00
f00a11bf9b fix(core): update 2019-09-10 18:02:42 +02:00
7b0f2ab8d6 2.0.5 2019-09-10 18:02:23 +02:00
39 changed files with 13715 additions and 1417 deletions

20
.gitignore vendored
View File

@ -1,6 +1,20 @@
node_modules/
.nogit/
# artifacts
coverage/
public/
pages/
test/testresult/
.nogit/
# installs
node_modules/
# caches
.yarn/
.cache/
.rpt2_cache
# builds
dist/
dist_*/
# custom

View File

@ -1,144 +1,122 @@
# gitzone ci_default
image: hosttoday/ht-docker-node:npmci
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache:
paths:
- .npmci_cache/
key: "$CI_BUILD_STAGE"
- .npmci_cache/
key: '$CI_BUILD_STAGE'
stages:
- security
- test
- release
- metadata
- security
- test
- release
- metadata
before_script:
- npm install -g @shipzone/npmci
# ====================
# security stage
# ====================
mirror:
stage: security
script:
- npmci git mirror
tags:
- docker
- notpriv
snyk:
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci command npm install -g snyk
- npmci command npm install --ignore-scripts
- npmci command snyk test
- npmci command npm install --production --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=prod --production
tags:
- docker
- notpriv
sast:
stage: security
image: registry.gitlab.com/hosttoday/ht-docker-dbase:npmci
variables:
DOCKER_DRIVER: overlay2
- docker
allow_failure: true
services:
- docker:stable-dind
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci npm prepare
- npmci npm install
- npmci command npm run build
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
--env SAST_CONFIDENCE_LEVEL="${SAST_CONFIDENCE_LEVEL:-3}"
--volume "$PWD:/code"
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/sast:$SP_VERSION" /app/bin/run /code
artifacts:
reports:
sast: gl-sast-report.json
- npmci command npm install --ignore-scripts
- npmci command npm config set registry https://registry.npmjs.org
- npmci command npm audit --audit-level=high --only=dev
tags:
- docker
- priv
- docker
allow_failure: true
# ====================
# test stage
# ====================
testLTS:
testStable:
stage: test
script:
- npmci npm prepare
- npmci node install lts
- npmci npm install
- npmci npm test
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
testSTABLE:
- docker
testBuild:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
- docker
release:
stage: release
script:
- npmci node install stable
- npmci npm publish
- npmci node install stable
- npmci npm publish
only:
- tags
- tags
tags:
- docker
- notpriv
- lossless
- docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
image: docker:stable
allow_failure: true
services:
- docker:stable-dind
only:
- tags
script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
--env SOURCE_CODE="$PWD"
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
artifacts:
paths: [codeclimate.json]
- npmci command npm install -g typescript
- npmci npm prepare
- npmci npm install
tags:
- docker
- priv
- lossless
- docker
- priv
trigger:
stage: metadata
script:
- npmci trigger
- npmci trigger
only:
- tags
- tags
tags:
- docker
- notpriv
- lossless
- docker
- notpriv
pages:
image: hosttoday/ht-docker-node:npmci
stage: metadata
script:
- npmci command npm install -g typedoc typescript
- npmci node install stable
- npmci npm prepare
- npmci npm install
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
- npmci command npm run buildDocs
tags:
- lossless
- docker
- notpriv
only:
@ -146,5 +124,5 @@ pages:
artifacts:
expire_in: 1 week
paths:
- public
- public
allow_failure: true

4
.snyk
View File

@ -1,4 +0,0 @@
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.13.3
ignore: {}
patch: {}

11
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "npm test",
"name": "Run npm test",
"request": "launch",
"type": "node-terminal"
}
]
}

26
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,26 @@
{
"json.schemas": [
{
"fileMatch": ["/npmextra.json"],
"schema": {
"type": "object",
"properties": {
"npmci": {
"type": "object",
"description": "settings for npmci"
},
"gitzone": {
"type": "object",
"description": "settings for gitzone",
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}
}
}
}
]
}

View File

@ -1,40 +0,0 @@
# @pushrocks/smarthbs
handlebars with better fs support
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smarthbs)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smarthbs)
* [github.com (source mirror)](https://github.com/pushrocks/smarthbs)
* [docs (typedoc)](https://pushrocks.gitlab.io/smarthbs/)
## Status for master
[![build status](https://gitlab.com/pushrocks/smarthbs/badges/master/build.svg)](https://gitlab.com/pushrocks/smarthbs/commits/master)
[![coverage report](https://gitlab.com/pushrocks/smarthbs/badges/master/coverage.svg)](https://gitlab.com/pushrocks/smarthbs/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/smarthbs.svg)](https://www.npmjs.com/package/@pushrocks/smarthbs)
[![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/smarthbs/badge.svg)](https://snyk.io/test/npm/@pushrocks/smarthbs)
[![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
## Usage
> Note: Why did we decide against a class based architecture?
> Easy: handlebars.js is already pretty determined how things are handled internally, namely a global partial template registry
> It doesn't make sense to then introduce a scoped partial template approach.
```javascript
import * as smarthbs from 'smarthbs';
// read all .hbs files in a directory and any child directories and use relative path as partial string identifier
smarthbs.registerPartialDir(testPartialDir);
// read all .hbs files in a particular directory and level, output them to a destination and specify a .json file to read any referenced data
smarthbs.compileDirectory(testHbsDir, testResultDir, 'data.json');
```
For further information read the linked docs at the top of this readme.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://maintainedby.lossless.com)

9
dist/index.d.ts vendored
View File

@ -1,9 +0,0 @@
import * as plugins from './smarthbs.plugins';
export declare type TTemplateStringType = 'filePath' | 'code';
export declare let handlebars: typeof plugins.handlebars;
export * from './smarthbs.compile';
import './smarthbs.helpers';
export * from './smarthbs.partials';
export * from './smarthbs.template';
export * from './smarthbs.variables';
export * from './smarthbs.postprocess';

21
dist/index.js vendored
View File

@ -1,21 +0,0 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = __importStar(require("./smarthbs.plugins"));
exports.handlebars = plugins.handlebars;
__export(require("./smarthbs.compile"));
require("./smarthbs.helpers");
__export(require("./smarthbs.partials"));
__export(require("./smarthbs.template"));
__export(require("./smarthbs.variables"));
__export(require("./smarthbs.postprocess"));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7QUFBQSw0REFBOEM7QUFHbkMsUUFBQSxVQUFVLEdBQUcsT0FBTyxDQUFDLFVBQVUsQ0FBQztBQUMzQyx3Q0FBbUM7QUFDbkMsOEJBQTRCO0FBQzVCLHlDQUFvQztBQUNwQyx5Q0FBb0M7QUFDcEMsMENBQXFDO0FBQ3JDLDRDQUF1QyJ9

View File

@ -1,4 +0,0 @@
/**
* compiles a directory and outputs it
*/
export declare let compileDirectory: (originDirPathArg: string, destinationDirPathArg: string, dataFileNameArg: string) => Promise<void>;

View File

@ -1,27 +0,0 @@
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = __importStar(require("./smarthbs.plugins"));
/**
* compiles a directory and outputs it
*/
exports.compileDirectory = async (originDirPathArg, destinationDirPathArg, dataFileNameArg) => {
let hbsFilePathArray = plugins.smartfile.fs.listFilesSync(originDirPathArg, /.hbs/);
let data = plugins.smartfile.fs.toObjectSync(plugins.path.join(originDirPathArg, dataFileNameArg));
for (let hbsFilePath of hbsFilePathArray) {
let parsedPath = plugins.path.parse(hbsFilePath);
let hbsFileString = plugins.smartfile.fs.toStringSync(plugins.path.join(originDirPathArg, hbsFilePath));
let template = plugins.handlebars.compile(hbsFileString);
let output = template(data);
console.log('hi ' + output + ' hi');
await plugins.smartfile.fs.ensureDir(destinationDirPathArg);
plugins.smartfile.memory.toFsSync(output, plugins.path.join(destinationDirPathArg, parsedPath.name + '.html'));
}
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRoYnMuY29tcGlsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0aGJzLmNvbXBpbGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O0FBQUEsNERBQThDO0FBRTlDOztHQUVHO0FBQ1EsUUFBQSxnQkFBZ0IsR0FBRyxLQUFLLEVBQ2pDLGdCQUF3QixFQUN4QixxQkFBNkIsRUFDN0IsZUFBdUIsRUFDdkIsRUFBRTtJQUNGLElBQUksZ0JBQWdCLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxFQUFFLENBQUMsYUFBYSxDQUFDLGdCQUFnQixFQUFFLE1BQU0sQ0FBQyxDQUFDO0lBQ3BGLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUMsRUFBRSxDQUFDLFlBQVksQ0FDMUMsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsZ0JBQWdCLEVBQUUsZUFBZSxDQUFDLENBQ3JELENBQUM7SUFDRixLQUFLLElBQUksV0FBVyxJQUFJLGdCQUFnQixFQUFFO1FBQ3hDLElBQUksVUFBVSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLFdBQVcsQ0FBQyxDQUFDO1FBQ2pELElBQUksYUFBYSxHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUMsRUFBRSxDQUFDLFlBQVksQ0FDbkQsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsZ0JBQWdCLEVBQUUsV0FBVyxDQUFDLENBQ2pELENBQUM7UUFDRixJQUFJLFFBQVEsR0FBRyxPQUFPLENBQUMsVUFBVSxDQUFDLE9BQU8sQ0FBQyxhQUFhLENBQUMsQ0FBQztRQUN6RCxJQUFJLE1BQU0sR0FBRyxRQUFRLENBQUMsSUFBSSxDQUFDLENBQUM7UUFDNUIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEdBQUcsTUFBTSxHQUFHLEtBQUssQ0FBQyxDQUFDO1FBQ3BDLE1BQU0sT0FBTyxDQUFDLFNBQVMsQ0FBQyxFQUFFLENBQUMsU0FBUyxDQUFDLHFCQUFxQixDQUFDLENBQUM7UUFDNUQsT0FBTyxDQUFDLFNBQVMsQ0FBQyxNQUFNLENBQUMsUUFBUSxDQUMvQixNQUFNLEVBQ04sT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMscUJBQXFCLEVBQUUsVUFBVSxDQUFDLElBQUksR0FBRyxPQUFPLENBQUMsQ0FDcEUsQ0FBQztLQUNIO0FBQ0gsQ0FBQyxDQUFDIn0=

View File

@ -1 +0,0 @@
export {};

View File

@ -1,39 +0,0 @@
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = __importStar(require("./smarthbs.plugins"));
/**
* Helper:
* Allows you to analyze a context
*/
plugins.handlebars.registerHelper('__analyze', analyzeContext => {
if (typeof analyzeContext === 'string') {
if (plugins.handlebars.partials[analyzeContext]) {
console.log(`The analyzed partial ${analyzeContext} looks like this`);
console.log(plugins.handlebars.partials[analyzeContext]);
}
else {
console.error(`The Partial ${analyzeContext} cannot be found`);
}
return 'analyzed';
}
});
/**
* Helper:
* logs all registered partials to console
*/
plugins.handlebars.registerHelper('__allPartialsLog', analyzeContext => {
console.log(plugins.handlebars.partials);
return 'analyzed';
});
plugins.handlebars.registerHelper('__compile', (evaluationString, evaluationContext) => {
let template = plugins.handlebars.compile(evaluationString);
return template(evaluationContext);
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRoYnMuaGVscGVycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0aGJzLmhlbHBlcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O0FBQUEsNERBQThDO0FBRTlDOzs7R0FHRztBQUNILE9BQU8sQ0FBQyxVQUFVLENBQUMsY0FBYyxDQUFDLFdBQVcsRUFBRSxjQUFjLENBQUMsRUFBRTtJQUM5RCxJQUFJLE9BQU8sY0FBYyxLQUFLLFFBQVEsRUFBRTtRQUN0QyxJQUFJLE9BQU8sQ0FBQyxVQUFVLENBQUMsUUFBUSxDQUFDLGNBQWMsQ0FBQyxFQUFFO1lBQy9DLE9BQU8sQ0FBQyxHQUFHLENBQUMsd0JBQXdCLGNBQWMsa0JBQWtCLENBQUMsQ0FBQztZQUN0RSxPQUFPLENBQUMsR0FBRyxDQUFDLE9BQU8sQ0FBQyxVQUFVLENBQUMsUUFBUSxDQUFDLGNBQWMsQ0FBQyxDQUFDLENBQUM7U0FDMUQ7YUFBTTtZQUNMLE9BQU8sQ0FBQyxLQUFLLENBQUMsZUFBZSxjQUFjLGtCQUFrQixDQUFDLENBQUM7U0FDaEU7UUFDRCxPQUFPLFVBQVUsQ0FBQztLQUNuQjtBQUNILENBQUMsQ0FBQyxDQUFDO0FBRUg7OztHQUdHO0FBQ0gsT0FBTyxDQUFDLFVBQVUsQ0FBQyxjQUFjLENBQUMsa0JBQWtCLEVBQUUsY0FBYyxDQUFDLEVBQUU7SUFDckUsT0FBTyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsVUFBVSxDQUFDLFFBQVEsQ0FBQyxDQUFDO0lBQ3pDLE9BQU8sVUFBVSxDQUFDO0FBQ3BCLENBQUMsQ0FBQyxDQUFDO0FBRUgsT0FBTyxDQUFDLFVBQVUsQ0FBQyxjQUFjLENBQUMsV0FBVyxFQUFFLENBQUMsZ0JBQWdCLEVBQUUsaUJBQWlCLEVBQUUsRUFBRTtJQUNyRixJQUFJLFFBQVEsR0FBRyxPQUFPLENBQUMsVUFBVSxDQUFDLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFDO0lBQzVELE9BQU8sUUFBUSxDQUFDLGlCQUFpQixDQUFDLENBQUM7QUFDckMsQ0FBQyxDQUFDLENBQUMifQ==

View File

@ -1,4 +0,0 @@
/**
* registers a directory of partials to make them available within handlebars compilation
*/
export declare let registerPartialDir: (dirPathArg: string) => Promise<any>;

View File

@ -1,33 +0,0 @@
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = __importStar(require("./smarthbs.plugins"));
/**
* registers a directory of partials to make them available within handlebars compilation
*/
exports.registerPartialDir = (dirPathArg) => {
let done = plugins.smartpromise.defer();
plugins.smartfile.fs.listFileTree(dirPathArg, '**/*.hbs').then(hbsFileArrayArg => {
for (let hbsFilePath of hbsFileArrayArg) {
let parsedPath = plugins.path.parse(hbsFilePath);
let hbsFileString = plugins.smartfile.fs.toStringSync(plugins.path.join(dirPathArg, hbsFilePath));
if (parsedPath.dir === '/') {
parsedPath.dir = '';
}
if (parsedPath.dir !== '') {
parsedPath.dir = parsedPath.dir + '/';
}
let partialName = `partials/${parsedPath.dir}${parsedPath.name}`;
plugins.handlebars.registerPartial(partialName, hbsFileString);
done.resolve();
}
});
return done.promise;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRoYnMucGFydGlhbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGhicy5wYXJ0aWFscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBQSw0REFBOEM7QUFFOUM7O0dBRUc7QUFDUSxRQUFBLGtCQUFrQixHQUFHLENBQUMsVUFBa0IsRUFBZ0IsRUFBRTtJQUNuRSxJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsWUFBWSxDQUFDLEtBQUssRUFBRSxDQUFDO0lBQ3hDLE9BQU8sQ0FBQyxTQUFTLENBQUMsRUFBRSxDQUFDLFlBQVksQ0FBQyxVQUFVLEVBQUUsVUFBVSxDQUFDLENBQUMsSUFBSSxDQUFDLGVBQWUsQ0FBQyxFQUFFO1FBQy9FLEtBQUssSUFBSSxXQUFXLElBQUksZUFBZSxFQUFFO1lBQ3ZDLElBQUksVUFBVSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLFdBQVcsQ0FBQyxDQUFDO1lBQ2pELElBQUksYUFBYSxHQUFHLE9BQU8sQ0FBQyxTQUFTLENBQUMsRUFBRSxDQUFDLFlBQVksQ0FDbkQsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsVUFBVSxFQUFFLFdBQVcsQ0FBQyxDQUMzQyxDQUFDO1lBQ0YsSUFBSSxVQUFVLENBQUMsR0FBRyxLQUFLLEdBQUcsRUFBRTtnQkFDMUIsVUFBVSxDQUFDLEdBQUcsR0FBRyxFQUFFLENBQUM7YUFDckI7WUFDRCxJQUFJLFVBQVUsQ0FBQyxHQUFHLEtBQUssRUFBRSxFQUFFO2dCQUN6QixVQUFVLENBQUMsR0FBRyxHQUFHLFVBQVUsQ0FBQyxHQUFHLEdBQUcsR0FBRyxDQUFDO2FBQ3ZDO1lBQ0QsSUFBSSxXQUFXLEdBQUcsWUFBWSxVQUFVLENBQUMsR0FBRyxHQUFHLFVBQVUsQ0FBQyxJQUFJLEVBQUUsQ0FBQztZQUNqRSxPQUFPLENBQUMsVUFBVSxDQUFDLGVBQWUsQ0FBQyxXQUFXLEVBQUUsYUFBYSxDQUFDLENBQUM7WUFDL0QsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFDO1NBQ2hCO0lBQ0gsQ0FBQyxDQUFDLENBQUM7SUFDSCxPQUFPLElBQUksQ0FBQyxPQUFPLENBQUM7QUFDdEIsQ0FBQyxDQUFDIn0=

View File

@ -1,6 +0,0 @@
import * as handlebars from 'handlebars';
import lodashUniq from 'lodash.uniq';
import * as path from 'path';
import * as smartfile from '@pushrocks/smartfile';
import * as smartpromise from '@pushrocks/smartpromise';
export { handlebars, lodashUniq, path, smartfile, smartpromise };

View File

@ -1,23 +0,0 @@
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const handlebars = __importStar(require("handlebars"));
exports.handlebars = handlebars;
const lodash_uniq_1 = __importDefault(require("lodash.uniq"));
exports.lodashUniq = lodash_uniq_1.default;
const path = __importStar(require("path"));
exports.path = path;
const smartfile = __importStar(require("@pushrocks/smartfile"));
exports.smartfile = smartfile;
const smartpromise = __importStar(require("@pushrocks/smartpromise"));
exports.smartpromise = smartpromise;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRoYnMucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0aGJzLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7O0FBQUEsdURBQXlDO0FBTWhDLGdDQUFVO0FBTG5CLDhEQUFxQztBQUtoQixxQkFMZCxxQkFBVSxDQUtjO0FBSi9CLDJDQUE2QjtBQUlJLG9CQUFJO0FBSHJDLGdFQUFrRDtBQUdYLDhCQUFTO0FBRmhELHNFQUF3RDtBQUVOLG9DQUFZIn0=

View File

@ -1,5 +0,0 @@
/**
* allows you to keep handlebars in place across multiple iterations
* helpful when handlebars syntax is used by more than one tool in a build chain
*/
export declare let postprocess: (stringArg: string) => Promise<string>;

View File

@ -1,15 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
let safeSyntaxBeginRegex = /{-{/g;
let safeSyntaxEndRegex = /}-}/g;
/**
* allows you to keep handlebars in place across multiple iterations
* helpful when handlebars syntax is used by more than one tool in a build chain
*/
exports.postprocess = async (stringArg) => {
let processedString = stringArg;
processedString = processedString.replace(safeSyntaxBeginRegex, '{{');
processedString = processedString.replace(safeSyntaxEndRegex, '}}');
return processedString;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRoYnMucG9zdHByb2Nlc3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGhicy5wb3N0cHJvY2Vzcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUVBLElBQUksb0JBQW9CLEdBQUcsTUFBTSxDQUFDO0FBQ2xDLElBQUksa0JBQWtCLEdBQUcsTUFBTSxDQUFDO0FBRWhDOzs7R0FHRztBQUNRLFFBQUEsV0FBVyxHQUFHLEtBQUssRUFBRSxTQUFpQixFQUFtQixFQUFFO0lBQ3BFLElBQUksZUFBZSxHQUFHLFNBQVMsQ0FBQztJQUNoQyxlQUFlLEdBQUcsZUFBZSxDQUFDLE9BQU8sQ0FBQyxvQkFBb0IsRUFBRSxJQUFJLENBQUMsQ0FBQztJQUN0RSxlQUFlLEdBQUcsZUFBZSxDQUFDLE9BQU8sQ0FBQyxrQkFBa0IsRUFBRSxJQUFJLENBQUMsQ0FBQztJQUNwRSxPQUFPLGVBQWUsQ0FBQztBQUN6QixDQUFDLENBQUMifQ==

View File

@ -1,9 +0,0 @@
import * as plugins from './smarthbs.plugins';
/**
* get a template for a file on disk
*/
export declare let getTemplateForFile: (filePathArg: string) => Promise<plugins.handlebars.TemplateDelegate<any>>;
/**
* get a template for string
*/
export declare let getTemplateForString: (fileStringArg: string) => Promise<plugins.handlebars.TemplateDelegate<any>>;

View File

@ -1,24 +0,0 @@
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = __importStar(require("./smarthbs.plugins"));
/**
* get a template for a file on disk
*/
exports.getTemplateForFile = async (filePathArg) => {
let filePathAbsolute = plugins.path.resolve(filePathArg);
return plugins.handlebars.compile(plugins.smartfile.fs.toStringSync(filePathAbsolute));
};
/**
* get a template for string
*/
exports.getTemplateForString = async (fileStringArg) => {
return plugins.handlebars.compile(fileStringArg);
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRoYnMudGVtcGxhdGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGhicy50ZW1wbGF0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBQSw0REFBOEM7QUFFOUM7O0dBRUc7QUFDUSxRQUFBLGtCQUFrQixHQUFHLEtBQUssRUFBRSxXQUFtQixFQUFFLEVBQUU7SUFDNUQsSUFBSSxnQkFBZ0IsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQztJQUN6RCxPQUFPLE9BQU8sQ0FBQyxVQUFVLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxTQUFTLENBQUMsRUFBRSxDQUFDLFlBQVksQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFDLENBQUM7QUFDekYsQ0FBQyxDQUFDO0FBRUY7O0dBRUc7QUFDUSxRQUFBLG9CQUFvQixHQUFHLEtBQUssRUFBRSxhQUFxQixFQUFFLEVBQUU7SUFDaEUsT0FBTyxPQUFPLENBQUMsVUFBVSxDQUFDLE9BQU8sQ0FBQyxhQUFhLENBQUMsQ0FBQztBQUNuRCxDQUFDLENBQUMifQ==

View File

@ -1,12 +0,0 @@
/**
* finds all variables in a handlebars template
* @param hbsStringArg
*/
export declare let findVarsInHbsString: (hbsStringArg: string) => Promise<string[]>;
/**
* checks if supplied variables satisfy an handlebars template
* @param hbsStringArg
* @param varObjectArg
* @return string array with missing variable names
*/
export declare let checkVarsSatisfaction: (hbsStringArg: string, varObjectArg: any) => Promise<string[]>;

View File

@ -1,74 +0,0 @@
"use strict";
// This file contains code that makes it easy to search handlebar templates for variables.
// Why? To get a clue if you are missing some.
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = __importStar(require("./smarthbs.plugins"));
// the curly regex objects
let tripleCurlyRegex = /{{{\s*[\w\.]+\s*}}}/g;
let doubleCurlyRegex = /{{\s*[\w\.]+\s*}}/g;
let nameInCurlsRegex = /[\w\.]+/;
/**
* finds all variables in a handlebars template
* @param hbsStringArg
*/
exports.findVarsInHbsString = async (hbsStringArg) => {
let hbsString = hbsStringArg; // make sure we have a new string object that we may destroy
let varNameArray = [];
let tripleCurlyMatches = hbsString.match(tripleCurlyRegex);
if (tripleCurlyMatches) {
hbsString = hbsString.replace(tripleCurlyRegex, '[[[replaced]]]');
varNameArray = varNameArray.concat(tripleCurlyMatches);
}
let doubleCurlyMatches = hbsString.match(doubleCurlyRegex);
if (doubleCurlyMatches) {
varNameArray = varNameArray.concat(doubleCurlyMatches);
}
// make sure we are clean from curly brackets
varNameArray = varNameArray.map(x => {
return x.match(nameInCurlsRegex)[0];
});
// make sure are uniq
varNameArray = plugins.lodashUniq(varNameArray);
return varNameArray;
};
/**
* checks if supplied variables satisfy an handlebars template
* @param hbsStringArg
* @param varObjectArg
* @return string array with missing variable names
*/
exports.checkVarsSatisfaction = async (hbsStringArg, varObjectArg) => {
// required vars as combined deep string with . notation
let requiredVarStrings = await exports.findVarsInHbsString(hbsStringArg);
// comparison objects
let suppliedVarsObject = varObjectArg;
let missingVarsObject = [];
// building the
for (let stringVar of requiredVarStrings) {
let splittedVars = stringVar.split('.');
let requiredPointer = suppliedVarsObject;
for (let i = 0; i < splittedVars.length; i++) {
let splitVar = splittedVars[i];
let varAvailable = requiredPointer[splitVar] !== undefined;
if (varAvailable && splittedVars.length === i + 1) {
// ok
}
else if (varAvailable) {
requiredPointer = requiredPointer[splitVar];
}
else {
missingVarsObject.push(stringVar);
i = splittedVars.length;
}
}
}
return missingVarsObject;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRoYnMudmFyaWFibGVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRoYnMudmFyaWFibGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSwwRkFBMEY7QUFDMUYsOENBQThDOzs7Ozs7Ozs7QUFFOUMsNERBQThDO0FBRTlDLDBCQUEwQjtBQUMxQixJQUFJLGdCQUFnQixHQUFHLHNCQUFzQixDQUFDO0FBQzlDLElBQUksZ0JBQWdCLEdBQUcsb0JBQW9CLENBQUM7QUFDNUMsSUFBSSxnQkFBZ0IsR0FBRyxTQUFTLENBQUM7QUFFakM7OztHQUdHO0FBQ1EsUUFBQSxtQkFBbUIsR0FBRyxLQUFLLEVBQUUsWUFBb0IsRUFBRSxFQUFFO0lBQzlELElBQUksU0FBUyxHQUFHLFlBQVksQ0FBQyxDQUFDLDREQUE0RDtJQUMxRixJQUFJLFlBQVksR0FBYSxFQUFFLENBQUM7SUFDaEMsSUFBSSxrQkFBa0IsR0FBRyxTQUFTLENBQUMsS0FBSyxDQUFDLGdCQUFnQixDQUFDLENBQUM7SUFDM0QsSUFBSSxrQkFBa0IsRUFBRTtRQUN0QixTQUFTLEdBQUcsU0FBUyxDQUFDLE9BQU8sQ0FBQyxnQkFBZ0IsRUFBRSxnQkFBZ0IsQ0FBQyxDQUFDO1FBQ2xFLFlBQVksR0FBRyxZQUFZLENBQUMsTUFBTSxDQUFDLGtCQUFrQixDQUFDLENBQUM7S0FDeEQ7SUFDRCxJQUFJLGtCQUFrQixHQUFHLFNBQVMsQ0FBQyxLQUFLLENBQUMsZ0JBQWdCLENBQUMsQ0FBQztJQUMzRCxJQUFJLGtCQUFrQixFQUFFO1FBQ3RCLFlBQVksR0FBRyxZQUFZLENBQUMsTUFBTSxDQUFDLGtCQUFrQixDQUFDLENBQUM7S0FDeEQ7SUFFRCw2Q0FBNkM7SUFDN0MsWUFBWSxHQUFHLFlBQVksQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLEVBQUU7UUFDbEMsT0FBTyxDQUFDLENBQUMsS0FBSyxDQUFDLGdCQUFnQixDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFDdEMsQ0FBQyxDQUFDLENBQUM7SUFFSCxxQkFBcUI7SUFDckIsWUFBWSxHQUFHLE9BQU8sQ0FBQyxVQUFVLENBQUMsWUFBWSxDQUFDLENBQUM7SUFDaEQsT0FBTyxZQUFZLENBQUM7QUFDdEIsQ0FBQyxDQUFDO0FBRUY7Ozs7O0dBS0c7QUFDUSxRQUFBLHFCQUFxQixHQUFHLEtBQUssRUFBRSxZQUFvQixFQUFFLFlBQWlCLEVBQUUsRUFBRTtJQUNuRix3REFBd0Q7SUFDeEQsSUFBSSxrQkFBa0IsR0FBRyxNQUFNLDJCQUFtQixDQUFDLFlBQVksQ0FBQyxDQUFDO0lBRWpFLHFCQUFxQjtJQUNyQixJQUFJLGtCQUFrQixHQUFHLFlBQVksQ0FBQztJQUN0QyxJQUFJLGlCQUFpQixHQUFhLEVBQUUsQ0FBQztJQUVyQyxlQUFlO0lBQ2YsS0FBSyxJQUFJLFNBQVMsSUFBSSxrQkFBa0IsRUFBRTtRQUN4QyxJQUFJLFlBQVksR0FBRyxTQUFTLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFDO1FBQ3hDLElBQUksZUFBZSxHQUFHLGtCQUFrQixDQUFDO1FBQ3pDLEtBQUssSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxZQUFZLENBQUMsTUFBTSxFQUFFLENBQUMsRUFBRSxFQUFFO1lBQzVDLElBQUksUUFBUSxHQUFHLFlBQVksQ0FBQyxDQUFDLENBQUMsQ0FBQztZQUMvQixJQUFJLFlBQVksR0FBRyxlQUFlLENBQUMsUUFBUSxDQUFDLEtBQUssU0FBUyxDQUFDO1lBQzNELElBQUksWUFBWSxJQUFJLFlBQVksQ0FBQyxNQUFNLEtBQUssQ0FBQyxHQUFHLENBQUMsRUFBRTtnQkFDakQsS0FBSzthQUNOO2lCQUFNLElBQUksWUFBWSxFQUFFO2dCQUN2QixlQUFlLEdBQUcsZUFBZSxDQUFDLFFBQVEsQ0FBQyxDQUFDO2FBQzdDO2lCQUFNO2dCQUNMLGlCQUFpQixDQUFDLElBQUksQ0FBQyxTQUFTLENBQUMsQ0FBQztnQkFDbEMsQ0FBQyxHQUFHLFlBQVksQ0FBQyxNQUFNLENBQUM7YUFDekI7U0FDRjtLQUNGO0lBQ0QsT0FBTyxpQkFBaUIsQ0FBQztBQUMzQixDQUFDLENBQUMifQ==

View File

@ -4,11 +4,12 @@
"npmAccessLevel": "public"
},
"gitzone": {
"projectType": "npm",
"module": {
"githost": "gitlab.com",
"gitscope": "pushrocks",
"gitrepo": "smarthbs",
"shortDescription": "handlebars with better fs support",
"description": "handlebars with better fs support",
"npmPackagename": "@pushrocks/smarthbs",
"license": "MIT"
}

14433
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,14 @@
{
"name": "@pushrocks/smarthbs",
"version": "2.0.4",
"version": "2.0.9",
"private": false,
"description": "handlebars with better fs support",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"type": "module",
"scripts": {
"test": "(tstest test/)",
"build": "(tsbuild)"
"build": "(tsbuild --allowimplicitany)"
},
"repository": {
"type": "git",
@ -23,17 +24,33 @@
},
"homepage": "https://gitlab.com/pkunz/smarthbs#README",
"dependencies": {
"@pushrocks/smartfile": "^7.0.4",
"@pushrocks/smartpromise": "^3.0.2",
"handlebars": "^4.2.0",
"lodash": "^4.17.11",
"@pushrocks/smartfile": "^10.0.2",
"@pushrocks/smartpath": "^5.0.5",
"@pushrocks/smartpromise": "^3.1.7",
"@types/lodash.uniq": "^4.5.7",
"handlebars": "^4.7.7",
"lodash.uniq": "^4.5.0"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.17",
"@gitzone/tsrun": "^1.2.8",
"@gitzone/tstest": "^1.0.24",
"@pushrocks/tapbundle": "^3.0.13",
"@types/node": "^12.7.4"
}
"@gitzone/tsbuild": "^2.1.63",
"@gitzone/tsrun": "^1.2.37",
"@gitzone/tstest": "^1.0.72",
"@pushrocks/tapbundle": "^5.0.4",
"@types/node": "^18.0.6"
},
"files": [
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"readme.md"
],
"browserslist": [
"last 1 chrome versions"
]
}

View File

@ -1,10 +1,14 @@
import { expect, tap } from '@pushrocks/tapbundle';
import * as smarthbs from '../ts/index';
import * as smarthbs from '../ts/index.js';
import * as smartpath from '@pushrocks/smartpath';
import * as path from 'path';
let testHbsDir = path.join(__dirname, 'hbs_testfiles');
const dirname = smartpath.get.dirnameFromImportMetaUrl(import.meta.url);
let testHbsDir = path.join(dirname, 'hbs_testfiles');
let testPartialDir = path.join(testHbsDir, 'partials');
let testResultDir = path.join(__dirname, 'testresult');
let testResultDir = path.join(dirname, 'testresult');
tap.test('smarthbs -> should create partials', async () => {
await smarthbs.registerPartialDir(testPartialDir);
@ -17,8 +21,8 @@ tap.test('smarthbs -> should compile a directory', async () => {
tap.test('', async () => {
let templateString = '{{{firstVar}}} {{secondVar}}';
let templateVars = await smarthbs.findVarsInHbsString(templateString);
expect(templateVars).to.include('firstVar');
expect(templateVars).to.include('secondVar');
expect(templateVars).toContain('firstVar');
expect(templateVars).toContain('secondVar');
});
tap.test('', async () => {
@ -29,12 +33,14 @@ tap.test('', async () => {
secondVar: 'hello',
fourthVar: {
otherKey: {
nextKey: 'wow'
}
}
nextKey: 'wow',
},
},
});
expect(missingVars).to.contain('thirdVar', 'fourthVar.someKey');
expect(missingVars).to.not.contain('secondVar', 'fourthVar.otherKey.nextKey');
expect(missingVars).toContain('thirdVar');
expect(missingVars).toContain('fourthVar.someKey');
expect(missingVars).not.toContain('secondVar');
expect(missingVars).not.toContain('fourthVar.otherKey.nextKey');
});
tap.start();

View File

@ -0,0 +1 @@
<head></head>analyzed

View File

@ -0,0 +1 @@
A second hbs file!

8
ts/00_commitinfo_data.ts Normal file
View File

@ -0,0 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@pushrocks/smarthbs',
version: '2.0.9',
description: 'handlebars with better fs support'
}

View File

@ -1,10 +1,10 @@
import * as plugins from './smarthbs.plugins';
import * as plugins from './smarthbs.plugins.js';
export type TTemplateStringType = 'filePath' | 'code';
export let handlebars = plugins.handlebars;
export * from './smarthbs.compile';
import './smarthbs.helpers';
export * from './smarthbs.partials';
export * from './smarthbs.template';
export * from './smarthbs.variables';
export * from './smarthbs.postprocess';
export * from './smarthbs.compile.js';
import './smarthbs.helpers.js';
export * from './smarthbs.partials.js';
export * from './smarthbs.template.js';
export * from './smarthbs.variables.js';
export * from './smarthbs.postprocess.js';

View File

@ -1,4 +1,4 @@
import * as plugins from './smarthbs.plugins';
import * as plugins from './smarthbs.plugins.js';
/**
* compiles a directory and outputs it

View File

@ -1,10 +1,10 @@
import * as plugins from './smarthbs.plugins';
import * as plugins from './smarthbs.plugins.js';
/**
* Helper:
* Allows you to analyze a context
*/
plugins.handlebars.registerHelper('__analyze', analyzeContext => {
plugins.handlebars.registerHelper('__analyze', (analyzeContext) => {
if (typeof analyzeContext === 'string') {
if (plugins.handlebars.partials[analyzeContext]) {
console.log(`The analyzed partial ${analyzeContext} looks like this`);
@ -20,7 +20,7 @@ plugins.handlebars.registerHelper('__analyze', analyzeContext => {
* Helper:
* logs all registered partials to console
*/
plugins.handlebars.registerHelper('__allPartialsLog', analyzeContext => {
plugins.handlebars.registerHelper('__allPartialsLog', (analyzeContext) => {
console.log(plugins.handlebars.partials);
return 'analyzed';
});

View File

@ -1,11 +1,11 @@
import * as plugins from './smarthbs.plugins';
import * as plugins from './smarthbs.plugins.js';
/**
* registers a directory of partials to make them available within handlebars compilation
*/
export let registerPartialDir = (dirPathArg: string): Promise<any> => {
let done = plugins.smartpromise.defer();
plugins.smartfile.fs.listFileTree(dirPathArg, '**/*.hbs').then(hbsFileArrayArg => {
plugins.smartfile.fs.listFileTree(dirPathArg, '**/*.hbs').then((hbsFileArrayArg) => {
for (let hbsFilePath of hbsFileArrayArg) {
let parsedPath = plugins.path.parse(hbsFilePath);
let hbsFileString = plugins.smartfile.fs.toStringSync(

View File

@ -1,5 +1,6 @@
import * as handlebars from 'handlebars';
import handlebars from 'handlebars';
import lodashUniq from 'lodash.uniq';
import * as smartpath from '@pushrocks/smartpath';
import * as path from 'path';
import * as smartfile from '@pushrocks/smartfile';
import * as smartpromise from '@pushrocks/smartpromise';

View File

@ -1,4 +1,4 @@
import * as plugins from './smarthbs.plugins';
import * as plugins from './smarthbs.plugins.js';
let safeSyntaxBeginRegex = /{-{/g;
let safeSyntaxEndRegex = /}-}/g;

View File

@ -1,4 +1,4 @@
import * as plugins from './smarthbs.plugins';
import * as plugins from './smarthbs.plugins.js';
/**
* get a template for a file on disk

View File

@ -1,7 +1,7 @@
// This file contains code that makes it easy to search handlebar templates for variables.
// Why? To get a clue if you are missing some.
import * as plugins from './smarthbs.plugins';
import * as plugins from './smarthbs.plugins.js';
// the curly regex objects
let tripleCurlyRegex = /{{{\s*[\w\.]+\s*}}}/g;
@ -26,7 +26,7 @@ export let findVarsInHbsString = async (hbsStringArg: string) => {
}
// make sure we are clean from curly brackets
varNameArray = varNameArray.map(x => {
varNameArray = varNameArray.map((x) => {
return x.match(nameInCurlsRegex)[0];
});

10
tsconfig.json Normal file
View File

@ -0,0 +1,10 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "nodenext",
"esModuleInterop": true
}
}

View File

@ -1,17 +0,0 @@
{
"extends": ["tslint:latest", "tslint-config-prettier"],
"rules": {
"semicolon": [true, "always"],
"no-console": false,
"ordered-imports": false,
"object-literal-sort-keys": false,
"member-ordering": {
"options":{
"order": [
"static-method"
]
}
}
},
"defaultSeverity": "warning"
}