@jaredwray/fumanchu 3.0.2 → 3.0.3

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.
Files changed (2) hide show
  1. package/dist/index.js +23 -3
  2. package/package.json +12 -9
package/dist/index.js CHANGED
@@ -2031,8 +2031,8 @@ var require_helpers = __commonJS({
2031
2031
  });
2032
2032
 
2033
2033
  // src/index.ts
2034
- var src_exports = {};
2035
- __export(src_exports, {
2034
+ var index_exports = {};
2035
+ __export(index_exports, {
2036
2036
  Handlebars: () => Handlebars,
2037
2037
  HelperRegistry: () => HelperRegistry,
2038
2038
  createHandlebars: () => createHandlebars,
@@ -2040,16 +2040,36 @@ __export(src_exports, {
2040
2040
  handlebars: () => handlebars,
2041
2041
  helpers: () => helpers2
2042
2042
  });
2043
- module.exports = __toCommonJS(src_exports);
2043
+ module.exports = __toCommonJS(index_exports);
2044
2044
  var HandlebarsLib = __toESM(require("handlebars"));
2045
2045
 
2046
2046
  // src/helpers/date.ts
2047
+ var import_chrono_node = require("chrono-node");
2048
+ var import_dayjs = __toESM(require("dayjs"));
2047
2049
  var year = () => (/* @__PURE__ */ new Date()).getFullYear().toString();
2050
+ var date = (humanReadableDate, formatString) => {
2051
+ const parsedDate = (0, import_chrono_node.parseDate)(humanReadableDate);
2052
+ if (!parsedDate) {
2053
+ throw new Error(`Unable to parse date: ${humanReadableDate}`);
2054
+ }
2055
+ return (0, import_dayjs.default)(parsedDate).format(formatString);
2056
+ };
2048
2057
  var helpers = [
2049
2058
  {
2050
2059
  name: "year",
2051
2060
  category: "date",
2052
2061
  fn: year
2062
+ },
2063
+ {
2064
+ name: "date",
2065
+ category: "date",
2066
+ fn: date
2067
+ },
2068
+ {
2069
+ /* Adding this in for legacy support */
2070
+ name: "moment",
2071
+ category: "date",
2072
+ fn: date
2053
2073
  }
2054
2074
  ];
2055
2075
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jaredwray/fumanchu",
3
3
  "description": "Handlebars + Helpers = Fumanchu",
4
- "version": "3.0.2",
4
+ "version": "3.0.3",
5
5
  "homepage": "https://github.com/jaredwray/fumanchu",
6
6
  "author": "Jared Wray (me@jaredwray.com)",
7
7
  "source": "dist/index.js",
@@ -10,6 +10,7 @@
10
10
  "scripts": {
11
11
  "test": "xo --fix && vitest run --coverage",
12
12
  "test:ci": "xo && vitest run --coverage",
13
+ "test:all": "npm run test && npm run test:legacy",
13
14
  "test:legacy": "npm run build && c8 mocha",
14
15
  "test:legacy:ci": "npm run build && c8 --reporter=lcov mocha",
15
16
  "build": "rimraf ./dist && tsup ./src/index.ts --format cjs --dts --clean",
@@ -58,10 +59,12 @@
58
59
  "dependencies": {
59
60
  "arr-flatten": "^1.1.0",
60
61
  "array-sort": "^1.0.0",
61
- "cacheable": "^1.8.5",
62
+ "cacheable": "^1.8.7",
63
+ "chrono-node": "^2.7.7",
62
64
  "create-frame": "^1.0.0",
65
+ "dayjs": "^1.11.13",
63
66
  "define-property": "^2.0.2",
64
- "ent": "^2.2.1",
67
+ "ent": "^2.2.2",
65
68
  "extend-shallow": "^3.0.2",
66
69
  "for-in": "^1.0.2",
67
70
  "for-own": "^1.0.0",
@@ -73,7 +76,7 @@
73
76
  "handlebars-utils": "^1.0.6",
74
77
  "has-value": "^2.0.2",
75
78
  "helper-date": "^1.0.1",
76
- "highlight.js": "^11.10.0",
79
+ "highlight.js": "^11.11.1",
77
80
  "html-tag": "^2.0.0",
78
81
  "is-even": "^1.0.0",
79
82
  "is-glob": "^4.0.3",
@@ -90,10 +93,10 @@
90
93
  "year": "^0.2.1"
91
94
  },
92
95
  "devDependencies": {
93
- "@vitest/coverage-v8": "^2.1.8",
94
- "c8": "^10.1.2",
96
+ "@vitest/coverage-v8": "^3.0.0",
97
+ "c8": "^10.1.3",
95
98
  "chai": "^4.3.10",
96
- "docula": "^0.9.5",
99
+ "docula": "^0.9.6",
97
100
  "engine-handlebars": "^1.1.0",
98
101
  "lodash": "^4.17.21",
99
102
  "mocha": "^10.8.2",
@@ -102,8 +105,8 @@
102
105
  "templates": "^1.2.9",
103
106
  "tsup": "^8.3.5",
104
107
  "typecript": "^0.0.1-security",
105
- "typescript": "^5.7.2",
106
- "vitest": "^2.1.8",
108
+ "typescript": "^5.7.3",
109
+ "vitest": "^3.0.0",
107
110
  "xo": "^0.60.0"
108
111
  },
109
112
  "xo": {