CodeSampleX

샘플

dotenv-expand 11.0.7: expand

검증된 샘플 — npm dotenv-expand 11.0.7: expand. node 22 · linux debian/x64 · docker에서 contract를 실행해 통과했습니다: dotenv-expand.expand supports both named export expand…

sha256:f5459646e417049fb21769b37f17af3d0a9fb4e50cf7a2fc0be521619337acc7

이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다. 통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다. MIT-0

실행 증거

선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.

증거 기준
서명된 컨트랙트 통과
검증 영수증
1
빌드한 서명 키
1
선언된 환경 linux 24 · ubuntu · glibc 2.39 x64 npm

검증 실행 환경

환경 컨트랙트 단계 실행일
node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2…
2026-09-06

케이스

HOW
목표
verify dotenv-expand.expand in pkg:npm/dotenv-expand@11.0.7
패키지
심벌
  • dotenv-expand.expand
생성일
2026-09-06T22:49:01Z

컨트랙트

  1. dotenv-expand.expand supports both named export expand and namespace export dotenvExpand.expand
  2. dotenv-expand.expand interpolates variable references from parsed and custom processEnv
  3. dotenv-expand.expand resolves fallback default values when variables are unset
  4. dotenv-expand.expand handles recursive and chained variable expansion
  5. dotenv-expand.expand preserves escaped dollar sign sequences
  6. dotenv-expand.expand writes resolved variables back to processEnv and returns options object

파일

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • test/contract.mjs

소스 아티팩트 내려받기 (tar.gz)

소스

PROMPT.md
Clean-room public code sample — generation instructions

Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.

A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.

Goal: verify dotenv-expand.expand in pkg:npm/dotenv-expand@11.0.7
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/dotenv-expand@11.0.7
Demonstrate these symbols/APIs:
  - dotenv-expand.expand

Rules:
  - One focused purpose; the smallest project that proves the goal.
  - Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
  - Pin every dependency with a lockfile so resolution is reproducible.
  - No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
  - No personal names, emails, company names, or project identifiers of any kind.
  - No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
  - Keep it under 200 files and 256KB packed.
csx.json
{"case":{"caseId":"case:sha256:921aaefd5e10a062dbabcc61c61754fa79e371a02a5ae6875872019af9b3840a","contract":["dotenv-expand.expand supports both named export expand and namespace export dotenvExpand.expand","dotenv-expand.expand interpolates variable references from parsed and custom processEnv","dotenv-expand.expand resolves fallback default values when variables are unset","dotenv-expand.expand handles recursive and chained variable expansion","dotenv-expand.expand preserves escaped dollar sign sequences","dotenv-expand.expand writes resolved variables back to processEnv and returns options object"],"goal":"verify dotenv-expand.expand in pkg:npm/dotenv-expand@11.0.7","kind":"HOW","packages":["pkg:npm/dotenv-expand@11.0.7"],"schemaVersion":1,"symbols":["dotenv-expand.expand"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/dotenv-expand@11.0.7"],"schemaVersion":1,"subject":"pkg:npm/dotenv-expand@11.0.7","symbols":["dotenv-expand.expand"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-dotenv-expand",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-dotenv-expand",
      "version": "1.0.0",
      "dependencies": {
        "dotenv-expand": "11.0.7"
      }
    },
    "node_modules/dotenv": {
      "version": "16.6.1",
      "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz",
      "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==",
      "license": "BSD-2-Clause",
      "engines": {
        "node": ">=12"
      },
      "funding": {
        "url": "https://dotenvx.com"
      }
    },
    "node_modules/dotenv-expand": {
      "version": "11.0.7",
      "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-11.0.7.tgz",
      "integrity": "sha512-zIHwmZPRshsCdpMDyVsqGmgyP0yT8GAgXUnkdAoJisxvf33k7yO6OuoKmcTGuXPWSsm8Oh88nZicRLA9Y0rUeA==",
      "license": "BSD-2-Clause",
      "dependencies": {
        "dotenv": "^16.4.5"
      },
      "engines": {
        "node": ">=12"
      },
      "funding": {
        "url": "https://dotenvx.com"
      }
    }
  }
}
package.json
{
  "name": "sample-dotenv-expand",
  "version": "1.0.0",
  "type": "module",
  "private": true,
  "description": "Clean-room verification sample for dotenv-expand.expand in dotenv-expand 11.0.7",
  "dependencies": {
    "dotenv-expand": "11.0.7"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify dotenv-expand.expand in pkg:npm/dotenv-expand@11.0.7",
  "kind": "HOW",
  "packages": [
    "pkg:npm/dotenv-expand@11.0.7"
  ],
  "symbols": [
    "dotenv-expand.expand"
  ]
}
test/contract.mjs
import assert from 'node:assert/strict';
import * as dotenvExpand from 'dotenv-expand';
import { expand } from 'dotenv-expand';

// 1. dotenv-expand.expand supports both named export expand and namespace export dotenvExpand.expand
assert.strictEqual(typeof expand, 'function');
assert.strictEqual(typeof dotenvExpand.expand, 'function');
assert.strictEqual(expand, dotenvExpand.expand);

// 2. dotenv-expand.expand interpolates variable references from parsed and custom processEnv
{
  const customEnv = { EXTERNAL_HOST: 'localhost' };
  const config = {
    processEnv: customEnv,
    parsed: {
      PORT: '9000',
      HOST_PORT: '${EXTERNAL_HOST}:${PORT}',
      BARE_VAR: '$PORT/metrics'
    }
  };
  const result = dotenvExpand.expand(config);
  assert.equal(result.parsed.HOST_PORT, 'localhost:9000');
  assert.equal(result.parsed.BARE_VAR, '9000/metrics');
}

// 3. dotenv-expand.expand resolves fallback default values when variables are unset
{
  const customEnv = { EXISTING_VAR: 'set_value' };
  const config = {
    processEnv: customEnv,
    parsed: {
      UNSET_WITH_COLON_DASH: '${UNSET_KEY:-default_colon}',
      UNSET_WITH_DASH: '${UNSET_KEY-default_dash}',
      SET_WITH_DEFAULT: '${EXISTING_VAR:-should_not_use}'
    }
  };
  const result = expand(config);
  assert.equal(result.parsed.UNSET_WITH_COLON_DASH, 'default_colon');
  assert.equal(result.parsed.UNSET_WITH_DASH, 'default_dash');
  assert.equal(result.parsed.SET_WITH_DEFAULT, 'set_value');
}

// 4. dotenv-expand.expand handles recursive and chained variable expansion
{
  const customEnv = {};
  const config = {
    processEnv: customEnv,
    parsed: {
      BASE_DIR: 'app',
      DATA_DIR: '${BASE_DIR}/data',
      CONFIG_FILE: '${DATA_DIR}/config.json',
      BACKUP_FILE: '${CONFIG_FILE}.bak'
    }
  };
  const result = expand(config);
  assert.equal(result.parsed.BASE_DIR, 'app');
  assert.equal(result.parsed.DATA_DIR, 'app/data');
  assert.equal(result.parsed.CONFIG_FILE, 'app/data/config.json');
  assert.equal(result.parsed.BACKUP_FILE, 'app/data/config.json.bak');
}

// 5. dotenv-expand.expand preserves escaped dollar sign sequences
{
  const customEnv = {};
  const config = {
    processEnv: customEnv,
    parsed: {
      ESCAPED_DOLLAR: '\\$PRESERVED_NAME',
      ESCAPED_WITH_BRACES: '\\${NOT_EXPANDED}'
    }
  };
  const result = expand(config);
  assert.equal(result.parsed.ESCAPED_DOLLAR, '$PRESERVED_NAME');
  assert.equal(result.parsed.ESCAPED_WITH_BRACES, '${NOT_EXPANDED}');
}

// 6. dotenv-expand.expand writes resolved variables back to processEnv and returns options object
{
  const customEnv = { INITIAL: 'orig' };
  const config = {
    processEnv: customEnv,
    parsed: {
      APP_NAME: 'test_app',
      APP_TITLE: '${APP_NAME}_service'
    }
  };
  const result = expand(config);
  assert.strictEqual(result, config);
  assert.equal(customEnv.APP_NAME, 'test_app');
  assert.equal(customEnv.APP_TITLE, 'test_app_service');
  assert.equal(customEnv.INITIAL, 'orig');
}

console.log('Contract assertions passed.');

오리진 시더

익명