@powerlines/plugin-date 0.12.137 → 0.12.139

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.
@@ -116,6 +116,7 @@ function TypescriptFileHeader(props) {
116
116
  */
117
117
  function TypescriptFileHeaderImports(props) {
118
118
  const { imports } = props;
119
+ const context = require_context.usePowerlines();
119
120
  const sourceFile = (0, __alloy_js_typescript.useSourceFile)();
120
121
  const scope = props.scope ?? sourceFile.scope;
121
122
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__alloy_js_core.Show, {
@@ -123,7 +124,7 @@ function TypescriptFileHeaderImports(props) {
123
124
  children: [
124
125
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_core.Show, {
125
126
  when: !!imports && Object.keys(imports).length > 0,
126
- children: Object.entries(imports ?? {}).map(([module$1, imported]) => {
127
+ children: Object.entries(imports ?? {}).filter(([key]) => key !== "$builtins").concat(imports && imports.$builtins ? Object.entries(imports.$builtins).map(([key, entry]) => [key.includes(":") ? key : `${context.config.output.builtinPrefix}:${key}`, entry]) : []).map(([module$1, imported]) => {
127
128
  return __alloy_js_core.code`import ${imported === null ? "" : imported.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (imported.filter((i) => !(0, __stryke_type_checks_is_string.isString)(i) && i.default).length > 0 && imported.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? ", " : "") + (imported.filter((i) => (0, __stryke_type_checks_is_string.isString)(i) || !i.default).length > 0 ? `{ ${imported.map((i) => (0, __stryke_type_checks_is_string.isString)(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} from "${module$1}";`;
128
129
  })
129
130
  }),
@@ -115,6 +115,7 @@ function TypescriptFileHeader(props) {
115
115
  */
116
116
  function TypescriptFileHeaderImports(props) {
117
117
  const { imports } = props;
118
+ const context = usePowerlines();
118
119
  const sourceFile = useSourceFile();
119
120
  const scope = props.scope ?? sourceFile.scope;
120
121
  return /* @__PURE__ */ jsxs(Show, {
@@ -122,7 +123,7 @@ function TypescriptFileHeaderImports(props) {
122
123
  children: [
123
124
  /* @__PURE__ */ jsx(Show, {
124
125
  when: !!imports && Object.keys(imports).length > 0,
125
- children: Object.entries(imports ?? {}).map(([module, imported]) => {
126
+ children: Object.entries(imports ?? {}).filter(([key]) => key !== "$builtins").concat(imports && imports.$builtins ? Object.entries(imports.$builtins).map(([key, entry]) => [key.includes(":") ? key : `${context.config.output.builtinPrefix}:${key}`, entry]) : []).map(([module, imported]) => {
126
127
  return code`import ${imported === null ? "" : imported.filter((i) => !isString(i) && i.default).map((i) => i.alias ? i.alias : i.name).join(", ") + (imported.filter((i) => !isString(i) && i.default).length > 0 && imported.filter((i) => isString(i) || !i.default).length > 0 ? ", " : "") + (imported.filter((i) => isString(i) || !i.default).length > 0 ? `{ ${imported.map((i) => isString(i) ? i : i.alias ? `${i.name} as ${i.alias}` : i.name).join(", ")} }` : "")} from "${module}";`;
127
128
  })
128
129
  }),
@@ -358,7 +358,122 @@ function EnvBuiltin(props) {
358
358
  export: true,
359
359
  const: true,
360
360
  initializer: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: __alloy_js_core.code`createEnv(${defaultConfig || "{}"} as Partial<Env>);` })
361
- })
361
+ }),
362
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
363
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
364
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.VarDeclaration, {
365
+ export: true,
366
+ const: true,
367
+ name: "isCI",
368
+ doc: "Detect if the application is running in a CI environment.",
369
+ initializer: __alloy_js_core.code`Boolean(
370
+ env.CI ||
371
+ env.RUN_ID ||
372
+ env.AGOLA_GIT_REF ||
373
+ env.AC_APPCIRCLE ||
374
+ env.APPVEYOR ||
375
+ env.CODEBUILD ||
376
+ env.TF_BUILD ||
377
+ env.bamboo_planKey ||
378
+ env.BITBUCKET_COMMIT ||
379
+ env.BITRISE_IO ||
380
+ env.BUDDY_WORKSPACE_ID ||
381
+ env.BUILDKITE ||
382
+ env.CIRCLECI ||
383
+ env.CIRRUS_CI ||
384
+ env.CF_BUILD_ID ||
385
+ env.CM_BUILD_ID ||
386
+ env.CI_NAME ||
387
+ env.DRONE ||
388
+ env.DSARI ||
389
+ env.EARTHLY_CI ||
390
+ env.EAS_BUILD ||
391
+ env.GERRIT_PROJECT ||
392
+ env.GITEA_ACTIONS ||
393
+ env.GITHUB_ACTIONS ||
394
+ env.GITLAB_CI ||
395
+ env.GOCD ||
396
+ env.BUILDER_OUTPUT ||
397
+ env.HARNESS_BUILD_ID ||
398
+ env.JENKINS_URL ||
399
+ env.LAYERCI ||
400
+ env.MAGNUM ||
401
+ env.NETLIFY ||
402
+ env.NEVERCODE ||
403
+ env.PROW_JOB_ID ||
404
+ env.RELEASE_BUILD_ID ||
405
+ env.RENDER ||
406
+ env.SAILCI ||
407
+ env.HUDSON ||
408
+ env.SCREWDRIVER ||
409
+ env.SEMAPHORE ||
410
+ env.SOURCEHUT ||
411
+ env.STRIDER ||
412
+ env.TASK_ID ||
413
+ env.RUN_ID ||
414
+ env.TEAMCITY_VERSION ||
415
+ env.TRAVIS ||
416
+ env.VELA ||
417
+ env.NOW_BUILDER ||
418
+ env.APPCENTER_BUILD_ID ||
419
+ env.CI_XCODE_PROJECT ||
420
+ env.XCS || false
421
+ );
422
+ `
423
+ }),
424
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
425
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
426
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc.TSDoc, {
427
+ heading: "Detect the \\`mode\\` of the current runtime environment.",
428
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tsdoc.TSDocRemarks, { children: __alloy_js_core.code`The \`mode\` is determined by the \`MODE\` environment variable, or falls back to the \`NEXT_PUBLIC_VERCEL_ENV\`, \`NODE_ENV\`, or defaults to \`production\`. While the value can potentially be any string, Storm Software generally only allows a value in the following list:
429
+ - \`production\`
430
+ - \`test\`
431
+ - \`development\`` })
432
+ }),
433
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.VarDeclaration, {
434
+ export: true,
435
+ const: true,
436
+ name: "mode",
437
+ initializer: __alloy_js_core.code`String(env.MODE) || "production"; `
438
+ }),
439
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
440
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
441
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.VarDeclaration, {
442
+ export: true,
443
+ const: true,
444
+ name: "isProduction",
445
+ doc: "Detect if the application is running in \\\"production\\\\\" mode",
446
+ initializer: __alloy_js_core.code`["prd", "prod", "production"].includes(mode.toLowerCase()); `
447
+ }),
448
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
449
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
450
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.VarDeclaration, {
451
+ export: true,
452
+ const: true,
453
+ name: "isTest",
454
+ doc: "Detect if the application is running in \"test\" mode",
455
+ initializer: __alloy_js_core.code`["tst", "test", "testing", "stg", "stage", "staging"].includes(mode.toLowerCase()) || env.TEST; `
456
+ }),
457
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
458
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
459
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.VarDeclaration, {
460
+ export: true,
461
+ const: true,
462
+ name: "isDevelopment",
463
+ doc: "Detect if the application is running in \"development\" mode",
464
+ initializer: __alloy_js_core.code`["dev", "development"].includes(mode.toLowerCase()); `
465
+ }),
466
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
467
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
468
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__alloy_js_typescript.VarDeclaration, {
469
+ export: true,
470
+ const: true,
471
+ name: "isDebug",
472
+ doc: "Detect if the application is running in \"debug\" mode",
473
+ initializer: __alloy_js_core.code`Boolean(isDevelopment && env.DEBUG); `
474
+ }),
475
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {}),
476
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hbr", {})
362
477
  ]
363
478
  });
364
479
  }
@@ -356,7 +356,122 @@ function EnvBuiltin(props) {
356
356
  export: true,
357
357
  const: true,
358
358
  initializer: /* @__PURE__ */ jsx(Fragment, { children: code`createEnv(${defaultConfig || "{}"} as Partial<Env>);` })
359
- })
359
+ }),
360
+ /* @__PURE__ */ jsx("hbr", {}),
361
+ /* @__PURE__ */ jsx("hbr", {}),
362
+ /* @__PURE__ */ jsx(VarDeclaration, {
363
+ export: true,
364
+ const: true,
365
+ name: "isCI",
366
+ doc: "Detect if the application is running in a CI environment.",
367
+ initializer: code`Boolean(
368
+ env.CI ||
369
+ env.RUN_ID ||
370
+ env.AGOLA_GIT_REF ||
371
+ env.AC_APPCIRCLE ||
372
+ env.APPVEYOR ||
373
+ env.CODEBUILD ||
374
+ env.TF_BUILD ||
375
+ env.bamboo_planKey ||
376
+ env.BITBUCKET_COMMIT ||
377
+ env.BITRISE_IO ||
378
+ env.BUDDY_WORKSPACE_ID ||
379
+ env.BUILDKITE ||
380
+ env.CIRCLECI ||
381
+ env.CIRRUS_CI ||
382
+ env.CF_BUILD_ID ||
383
+ env.CM_BUILD_ID ||
384
+ env.CI_NAME ||
385
+ env.DRONE ||
386
+ env.DSARI ||
387
+ env.EARTHLY_CI ||
388
+ env.EAS_BUILD ||
389
+ env.GERRIT_PROJECT ||
390
+ env.GITEA_ACTIONS ||
391
+ env.GITHUB_ACTIONS ||
392
+ env.GITLAB_CI ||
393
+ env.GOCD ||
394
+ env.BUILDER_OUTPUT ||
395
+ env.HARNESS_BUILD_ID ||
396
+ env.JENKINS_URL ||
397
+ env.LAYERCI ||
398
+ env.MAGNUM ||
399
+ env.NETLIFY ||
400
+ env.NEVERCODE ||
401
+ env.PROW_JOB_ID ||
402
+ env.RELEASE_BUILD_ID ||
403
+ env.RENDER ||
404
+ env.SAILCI ||
405
+ env.HUDSON ||
406
+ env.SCREWDRIVER ||
407
+ env.SEMAPHORE ||
408
+ env.SOURCEHUT ||
409
+ env.STRIDER ||
410
+ env.TASK_ID ||
411
+ env.RUN_ID ||
412
+ env.TEAMCITY_VERSION ||
413
+ env.TRAVIS ||
414
+ env.VELA ||
415
+ env.NOW_BUILDER ||
416
+ env.APPCENTER_BUILD_ID ||
417
+ env.CI_XCODE_PROJECT ||
418
+ env.XCS || false
419
+ );
420
+ `
421
+ }),
422
+ /* @__PURE__ */ jsx("hbr", {}),
423
+ /* @__PURE__ */ jsx("hbr", {}),
424
+ /* @__PURE__ */ jsx(TSDoc, {
425
+ heading: "Detect the \\`mode\\` of the current runtime environment.",
426
+ children: /* @__PURE__ */ jsx(TSDocRemarks, { children: code`The \`mode\` is determined by the \`MODE\` environment variable, or falls back to the \`NEXT_PUBLIC_VERCEL_ENV\`, \`NODE_ENV\`, or defaults to \`production\`. While the value can potentially be any string, Storm Software generally only allows a value in the following list:
427
+ - \`production\`
428
+ - \`test\`
429
+ - \`development\`` })
430
+ }),
431
+ /* @__PURE__ */ jsx(VarDeclaration, {
432
+ export: true,
433
+ const: true,
434
+ name: "mode",
435
+ initializer: code`String(env.MODE) || "production"; `
436
+ }),
437
+ /* @__PURE__ */ jsx("hbr", {}),
438
+ /* @__PURE__ */ jsx("hbr", {}),
439
+ /* @__PURE__ */ jsx(VarDeclaration, {
440
+ export: true,
441
+ const: true,
442
+ name: "isProduction",
443
+ doc: "Detect if the application is running in \\\"production\\\\\" mode",
444
+ initializer: code`["prd", "prod", "production"].includes(mode.toLowerCase()); `
445
+ }),
446
+ /* @__PURE__ */ jsx("hbr", {}),
447
+ /* @__PURE__ */ jsx("hbr", {}),
448
+ /* @__PURE__ */ jsx(VarDeclaration, {
449
+ export: true,
450
+ const: true,
451
+ name: "isTest",
452
+ doc: "Detect if the application is running in \"test\" mode",
453
+ initializer: code`["tst", "test", "testing", "stg", "stage", "staging"].includes(mode.toLowerCase()) || env.TEST; `
454
+ }),
455
+ /* @__PURE__ */ jsx("hbr", {}),
456
+ /* @__PURE__ */ jsx("hbr", {}),
457
+ /* @__PURE__ */ jsx(VarDeclaration, {
458
+ export: true,
459
+ const: true,
460
+ name: "isDevelopment",
461
+ doc: "Detect if the application is running in \"development\" mode",
462
+ initializer: code`["dev", "development"].includes(mode.toLowerCase()); `
463
+ }),
464
+ /* @__PURE__ */ jsx("hbr", {}),
465
+ /* @__PURE__ */ jsx("hbr", {}),
466
+ /* @__PURE__ */ jsx(VarDeclaration, {
467
+ export: true,
468
+ const: true,
469
+ name: "isDebug",
470
+ doc: "Detect if the application is running in \"debug\" mode",
471
+ initializer: code`Boolean(isDevelopment && env.DEBUG); `
472
+ }),
473
+ /* @__PURE__ */ jsx("hbr", {}),
474
+ /* @__PURE__ */ jsx("hbr", {})
360
475
  ]
361
476
  });
362
477
  }
@@ -1,5 +1,3 @@
1
- import "esbuild";
2
-
3
1
  //#region ../powerlines/src/types/build.d.ts
4
2
 
5
3
  type UnpluginBuildVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown";
@@ -1,4 +1,3 @@
1
- import "./build.mjs";
2
1
  import { BabelUserConfig, EnvironmentConfig, InlineConfig, OutputConfig, UserConfig } from "./config.mjs";
3
2
  import { NonUndefined } from "@stryke/types/base";
4
3
  import { ResolvedPreviewOptions } from "vite";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-date",
3
- "version": "0.12.137",
3
+ "version": "0.12.139",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin for injecting static .env configuration values to the code so that they're accessible at runtime.",
6
6
  "repository": {
@@ -128,7 +128,7 @@
128
128
  "files": ["dist/**/*"],
129
129
  "keywords": ["powerlines", "storm-software", "powerlines-plugin"],
130
130
  "dependencies": {
131
- "@powerlines/plugin-env": "^0.14.27",
131
+ "@powerlines/plugin-env": "^0.15.1",
132
132
  "@storm-software/config-tools": "^1.188.75",
133
133
  "@stryke/path": "^0.24.1",
134
134
  "powerlines": "^0.36.26"
@@ -138,5 +138,5 @@
138
138
  "@types/node": "^24.10.4"
139
139
  },
140
140
  "publishConfig": { "access": "public" },
141
- "gitHead": "f27028746c0657470a2c93af2e3224565ae7fd61"
141
+ "gitHead": "b9a0574767447bffa6549e0492812dfe64e879e3"
142
142
  }