How to use the @swim/codec.OutputSettings.styled function in @swim/codec

To help you get started, we’ve selected a few @swim/codec examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github swimos / swim / swim-js / swim-core-js / @swim / build / main / Build.ts View on Github external
if (project) {
          if (targetId) { // :
            const target = project.targets[targetId];
            if (target) {
              target.selected = true;
              targets = target.transitiveDeps(targets);
            }
          } else { // (:?)
            for (let j = 0; j < project.targetList.length; j += 1) {
              const target = project.targetList[j];
              target.selected = true;
              targets = target.transitiveDeps(targets);
            }
          }
        } else {
          const output = Unicode.stringOutput(OutputSettings.styled());
          OutputStyle.redBold(output);
          output.write("unknown project");
          OutputStyle.reset(output);
          output.write(" ");
          OutputStyle.yellow(output);
          output.write(projectId);
          OutputStyle.reset(output);
          console.log(output.bind());
        }
      } else if (targetId) { // :
        for (let j = 0; j < this.projectList.length; j += 1) {
          const target = this.projectList[j].targets[targetId];
          if (target) {
            target.selected = true;
            targets = target.transitiveDeps(targets);
          }
github swimos / swim / swim-system-js / swim-core-js / @swim / build / main / Target.ts View on Github external
protected onBundleError(error: Error): void {
    let output = Unicode.stringOutput(OutputSettings.styled());
    OutputStyle.redBold(output);
    output.write("error:");
    OutputStyle.reset(output);
    output.write(" ");
    output.write(error.message);
    console.log(output.bind());
    console.log();

    output = Unicode.stringOutput(OutputSettings.styled());
    OutputStyle.redBold(output);
    output.write("failed to bundle");
    OutputStyle.reset(output);
    output.write(" ");
    OutputStyle.yellow(output);
    output.write(this.uid);
    OutputStyle.reset(output);
    console.log(output.bind());
  }
github swimos / swim / swim-js / swim-core-js / @swim / build / main / Target.ts View on Github external
if (severity.level() >= Severity.ERROR_LEVEL) {
      this.failed = true;
    }
    if (error.file) {
      let tag: Tag;
      if (error.length! > 1) {
        const start = Target.tsMark(error.start!, error.file);
        const end = Target.tsMark(error.start! + error.length! - 1, error.file, message);
        tag = Span.from(start, end);
      } else {
        tag = Target.tsMark(error.start!, error.file, message);
      }

      const input = Unicode.stringInput(error.file.text).id(error.file.fileName);
      const diagnostic = new Diagnostic(input, tag, severity, "" + error.code, null, null);
      console.log(diagnostic.toString(OutputSettings.styled()));
    } else {
      const output = Unicode.stringOutput(OutputSettings.styled());
      Diagnostic.displayMessage(severity, message, output);
      console.log(output.bind());
    }
  }
github swimos / swim / swim-system-js / swim-core-js / @swim / build / main / Target.ts View on Github external
protected onMinifyError(error: Error): void {
    const output = Unicode.stringOutput(OutputSettings.styled());
    OutputStyle.redBold(output);
    output.write("error:");
    OutputStyle.reset(output);
    output.write(" ");
    output.write(error.message);
    console.log(output.bind());
    console.log();
  }
github swimos / swim / swim-system-js / swim-core-js / @swim / build / main / Build.ts View on Github external
printProjects(): void {
    const output = Unicode.stringOutput(OutputSettings.styled());
    OutputStyle.greenBold(output);
    output.write("projects");
    OutputStyle.reset(output);
    console.log(output.bind());
    for (let i = 0; i < this.projectList.length; i += 1) {
      const project = this.projectList[i];
      const output = Unicode.stringOutput(OutputSettings.styled());
      output.write(" - ");
      OutputStyle.yellow(output);
      output.write(project.id);
      OutputStyle.reset(output);
      console.log(output.bind());
    }
  }
github swimos / swim / swim-system-js / swim-core-js / @swim / build / main / Target.ts View on Github external
if (severity.level() >= Severity.ERROR_LEVEL) {
      this.failed = true;
    }
    if (error.file) {
      let tag: Tag;
      if (error.length! > 1) {
        const start = Target.tsMark(error.start!, error.file);
        const end = Target.tsMark(error.start! + error.length! - 1, error.file, message);
        tag = Span.from(start, end);
      } else {
        tag = Target.tsMark(error.start!, error.file, message);
      }

      const input = Unicode.stringInput(error.file.text).id(error.file.fileName);
      const diagnostic = new Diagnostic(input, tag, severity, "" + error.code, null, null);
      console.log(diagnostic.toString(OutputSettings.styled()));
    } else {
      const output = Unicode.stringOutput(OutputSettings.styled());
      Diagnostic.displayMessage(severity, message, output);
      console.log(output.bind());
    }
  }
github swimos / swim / swim-js / swim-core-js / @swim / build / main / Target.ts View on Github external
if (failure.getEndPosition().getPosition() - failure.getStartPosition().getPosition() > 1) {
      const start = Target.tslinkMark(failure.getStartPosition());
      const end = Target.tslinkMark(failure.getEndPosition(), -1, failure.getFailure());
      tag = Span.from(start, end);
    } else {
      tag =  Target.tslinkMark(failure.getStartPosition(), 0, failure.getFailure());
    }
    const severity = Target.tslintSeverity(failure.getRuleSeverity());
    if (severity.level() >= Severity.ERROR_LEVEL) {
      this.failed = true;
    }

    const sourceFile = (failure as any).sourceFile;
    const input = Unicode.stringInput(sourceFile.text).id(sourceFile.fileName);
    const diagnostic = new Diagnostic(input, tag, severity, failure.getRuleName(), null, null);
    console.log(diagnostic.toString(OutputSettings.styled()));
  }
github swimos / swim / swim-js / swim-core-js / @swim / build / main / Target.ts View on Github external
}
    }

    const docTarget = doc.converter.getComponent("doc-target");
    if (docTarget instanceof DocTarget) {
      docTarget.target = this;
      docTarget.fileTargetMap = fileTargetMap;
    }

    const t0 = Date.now();
    const project = doc.convert(fileNames);
    if (project) {
      doc.generateDocs(project, outDir);
      const dt = Date.now() - t0;

      output = Unicode.stringOutput(OutputSettings.styled());
      OutputStyle.greenBold(output);
      output.write("documented");
      OutputStyle.reset(output);
      output.write(" ");
      OutputStyle.yellow(output);
      output.write(this.uid);
      OutputStyle.reset(output);
      output.write(" in ");
      output.debug(dt);
      output.write("ms");
      console.log(output.bind());
      console.log();
      return Promise.resolve();
    } else {
      const output = Unicode.stringOutput(OutputSettings.styled());
      OutputStyle.redBold(output);
github swimos / swim / swim-system-js / swim-core-js / @swim / build / main / Target.ts View on Github external
const output = Unicode.stringOutput(OutputSettings.styled());
            OutputStyle.greenBold(output);
            output.write("tested");
            OutputStyle.reset(output);
            output.write(" ");
            OutputStyle.yellow(output);
            output.write(this.uid);
            OutputStyle.reset(output);
            output.write(" in ");
            output.debug(dt);
            output.write("ms");
            console.log(output.bind());
            console.log();
            resolve();
          } else {
            const output = Unicode.stringOutput(OutputSettings.styled());
            OutputStyle.redBold(output);
            output.write("failed to test");
            OutputStyle.reset(output);
            output.write(" ");
            OutputStyle.yellow(output);
            output.write(this.uid);
            OutputStyle.reset(output);
            console.log(output.bind());
            console.log();
            reject(code);
          }
        });
      });
github swimos / swim / swim-system-js / swim-core-js / @swim / build / main / Target.ts View on Github external
bundle(): Promise {
    this.cancelBundle();
    this.bundleTimer = -1;

    const output = Unicode.stringOutput(OutputSettings.styled());
    OutputStyle.greenBold(output);
    output.write("bundling");
    OutputStyle.reset(output);
    output.write(" ");
    OutputStyle.yellow(output);
    output.write(this.uid);
    OutputStyle.reset(output);
    console.log(output.bind());

    const bundleConfig = this.project.bundleConfig[this.id] as rollup.RollupOptions | undefined;
    if (bundleConfig) {
      const t0 = Date.now();
      const cwd = process.cwd();
      process.chdir(this.project.baseDir);
      return rollup.rollup(bundleConfig)
        .then((build: rollup.RollupBuild): Promise => {