fix(core): update

This commit is contained in:
2022-07-24 15:30:19 +02:00
parent 97400fa501
commit b382256cc7
21 changed files with 13690 additions and 1078 deletions

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];
});