@kosatyi/ejs 0.0.69 → 0.0.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var path = require('path');
4
3
  var fs = require('fs');
4
+ var path = require('path');
5
5
 
6
6
  var typeProp = function typeProp() {
7
7
  var args = [].slice.call(arguments);
@@ -820,10 +820,22 @@ function EJS(options) {
820
820
  return this;
821
821
  }
822
822
 
823
+ function readFile(path, template) {
824
+ return new Promise(function (resolve, reject) {
825
+ fs.readFile(joinPath(path, template), function (error, data) {
826
+ if (error) {
827
+ reject(error);
828
+ } else {
829
+ resolve(data.toString());
830
+ }
831
+ });
832
+ });
833
+ }
834
+
823
835
  /**
824
836
  *
825
837
  * @param {EJS} ejs
826
- * @return {function(*, *, *): Promise<String>}
838
+ * @return {function(name, options, callback): Promise<String>}
827
839
  */
828
840
  function expressRenderer(ejs) {
829
841
  return function (name, options, callback) {
@@ -848,18 +860,6 @@ function expressRenderer(ejs) {
848
860
  };
849
861
  }
850
862
 
851
- function readFile(path, template) {
852
- return new Promise(function (resolve, reject) {
853
- fs.readFile(joinPath(path, template), function (error, data) {
854
- if (error) {
855
- reject(error);
856
- } else {
857
- resolve(data.toString());
858
- }
859
- });
860
- });
861
- }
862
-
863
863
  var ejs = new EJS({
864
864
  resolver: readFile
865
865
  });
@@ -940,7 +940,6 @@ const httpRequest = (path, template) => {
940
940
 
941
941
  const ejs = new EJS({ resolver: httpRequest });
942
942
 
943
- const { render, context, compile, helpers, preload, configure, create } =
944
- ejs;
943
+ const { render, context, compile, helpers, preload, configure, create } = ejs;
945
944
 
946
945
  export { compile, configure, context, create, helpers, preload, render };
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import path from 'path';
2
1
  import fs from 'fs';
2
+ import path from 'path';
3
3
 
4
4
  const typeProp = function () {
5
5
  const args = [].slice.call(arguments);
@@ -934,10 +934,22 @@ function EJS(options) {
934
934
  return this
935
935
  }
936
936
 
937
+ function readFile(path, template) {
938
+ return new Promise((resolve, reject) => {
939
+ fs.readFile(joinPath(path, template), (error, data) => {
940
+ if (error) {
941
+ reject(error);
942
+ } else {
943
+ resolve(data.toString());
944
+ }
945
+ });
946
+ })
947
+ }
948
+
937
949
  /**
938
950
  *
939
951
  * @param {EJS} ejs
940
- * @return {function(*, *, *): Promise<String>}
952
+ * @return {function(name, options, callback): Promise<String>}
941
953
  */
942
954
  function expressRenderer(ejs) {
943
955
  return function (name, options, callback) {
@@ -969,22 +981,9 @@ function expressRenderer(ejs) {
969
981
  }
970
982
  }
971
983
 
972
- function readFile(path, template) {
973
- return new Promise((resolve, reject) => {
974
- fs.readFile(joinPath(path, template), (error, data) => {
975
- if (error) {
976
- reject(error);
977
- } else {
978
- resolve(data.toString());
979
- }
980
- });
981
- })
982
- }
983
-
984
984
  const ejs = new EJS({ resolver: readFile });
985
985
 
986
- const { render, context, compile, helpers, preload, configure, create } =
987
- ejs;
986
+ const { render, context, compile, helpers, preload, configure, create } = ejs;
988
987
 
989
988
  const __express = expressRenderer(ejs);
990
989
 
package/dist/umd/index.js CHANGED
@@ -821,12 +821,24 @@
821
821
  return this;
822
822
  }
823
823
 
824
- var fs = {};
824
+ var path = {};
825
+
826
+ function readFile(path$1, template) {
827
+ return new Promise(function (resolve, reject) {
828
+ path.readFile(joinPath(path$1, template), function (error, data) {
829
+ if (error) {
830
+ reject(error);
831
+ } else {
832
+ resolve(data.toString());
833
+ }
834
+ });
835
+ });
836
+ }
825
837
 
826
838
  /**
827
839
  *
828
840
  * @param {EJS} ejs
829
- * @return {function(*, *, *): Promise<String>}
841
+ * @return {function(name, options, callback): Promise<String>}
830
842
  */
831
843
  function expressRenderer(ejs) {
832
844
  return function (name, options, callback) {
@@ -839,7 +851,7 @@
839
851
  var viewPath = typeProp(isString, defaults.path, settings['views']);
840
852
  var viewCache = typeProp(isBoolean, defaults.cache, settings['view cache']);
841
853
  var viewOptions = extend({}, settings['view options']);
842
- var filename = fs.relative(viewPath, name);
854
+ var filename = path.relative(viewPath, name);
843
855
  viewOptions.path = viewPath;
844
856
  viewOptions.cache = viewCache;
845
857
  ejs.configure(viewOptions);
@@ -851,18 +863,6 @@
851
863
  };
852
864
  }
853
865
 
854
- function readFile(path, template) {
855
- return new Promise(function (resolve, reject) {
856
- fs.readFile(joinPath(path, template), function (error, data) {
857
- if (error) {
858
- reject(error);
859
- } else {
860
- resolve(data.toString());
861
- }
862
- });
863
- });
864
- }
865
-
866
866
  var ejs = new EJS({
867
867
  resolver: readFile
868
868
  });
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "EJS Templates",
4
4
  "homepage": "https://github.com/kosatyi/ejs",
5
5
  "type": "module",
6
- "version": "0.0.69",
6
+ "version": "0.0.71",
7
7
  "main": "dist/cjs/index.js",
8
8
  "module": "dist/esm/index.js",
9
9
  "browser": "dist/umd/browser.js",