@shwfed/nuxt 0.1.36 → 0.1.38

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/module.d.mts CHANGED
@@ -13,11 +13,14 @@ interface ModuleOptions {
13
13
  }>;
14
14
  }
15
15
  interface Env {
16
- ci: boolean;
17
16
  git: Readonly<{
18
17
  commit?: string;
19
18
  branch?: string;
20
19
  }>;
20
+ ci: Readonly<{
21
+ job?: string;
22
+ build?: number;
23
+ }>;
21
24
  }
22
25
  declare module 'nuxt/schema' {
23
26
  interface PublicRuntimeConfig {
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
3
  "configKey": "shwfed",
4
- "version": "0.1.36",
4
+ "version": "0.1.38",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -11,10 +11,13 @@ const module$1 = defineNuxtModule({
11
11
  setup(options, nuxt) {
12
12
  const resolver = createResolver(import.meta.url);
13
13
  nuxt.options.runtimeConfig.public.shwfed = defu(options, {
14
- ci: process.env.CI === "true",
15
14
  git: {
16
15
  commit: process.env.GIT_COMMIT,
17
16
  branch: process.env.GIT_LOCAL_BRANCH
17
+ },
18
+ ci: {
19
+ job: process.env.JOB_NAME,
20
+ build: process.env.BUILD_NUMBER ? Number.parseInt(process.env.BUILD_NUMBER) : void 0
18
21
  }
19
22
  });
20
23
  nuxt.options.css ||= [];
@@ -1,6 +1,2 @@
1
1
  import { Environment } from '@marcbachmann/cel-js';
2
- type Options = Readonly<Partial<{
3
- _: never;
4
- }>>;
5
- export declare function createEnvironment(_?: Options): Environment;
6
- export {};
2
+ export declare function createEnvironment(): Environment;
@@ -2,7 +2,7 @@ import { Environment, EvaluationError, Optional } from "@marcbachmann/cel-js";
2
2
  import { startOfDay, startOfWeek, startOfYear, startOfMonth, endOfDay, endOfWeek, endOfYear, endOfMonth, addYears, addMonths, addDays, addWeeks, setDate, setMonth, setYear, formatDate, isBefore, isAfter, isEqual } from "date-fns";
3
3
  import { TZDate } from "@date-fns/tz";
4
4
  import { BigNumber } from "bignumber.js";
5
- export function createEnvironment(_) {
5
+ export function createEnvironment() {
6
6
  const env = new Environment({
7
7
  enableOptionalTypes: true,
8
8
  homogeneousAggregateLiterals: false,
@@ -88,6 +88,10 @@ export function createEnvironment(_) {
88
88
  return number.toLocaleString(navigator.language, options);
89
89
  }).registerFunction("parseJSON(string): dyn", (string) => {
90
90
  return JSON.parse(string);
91
+ }).registerFunction("string.slice(int): string", (s, start) => {
92
+ return s.slice(Number(start));
93
+ }).registerFunction("string.slice(int, int): string", (s, start, end) => {
94
+ return s.slice(Number(start), Number(end));
91
95
  }).registerFunction("session(string): optional<string>", (key) => {
92
96
  if (typeof window === "undefined") return Optional.none();
93
97
  try {
@@ -5,7 +5,10 @@ export default defineNuxtPlugin({
5
5
  name: "shwfed-nuxt:cel",
6
6
  setup: () => {
7
7
  const config = useRuntimeConfig().public.shwfed;
8
- const env = createEnvironment({}).registerConstant("git", "map<string, string>", config.git);
8
+ const env = createEnvironment().registerConstant("git", "map<string, string>", config.git).registerConstant("ci", "map<string, dyn>", {
9
+ ...config.ci,
10
+ build: config.ci.build !== void 0 ? BigInt(config.ci.build) : void 0
11
+ });
9
12
  return {
10
13
  provide: {
11
14
  dsl: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
- "version": "0.1.36",
3
+ "version": "0.1.38",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "type": "module",