How to use the @swim/codec.Unicode.stringOutput 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-system-js / swim-core-js / @swim / build / main / Target.ts View on Github external
protected onCompileResult(status: ts.Diagnostic) {
    if (this.canCompile()) {
      if (status.code === 6031) {
        // watching
        this.failed = false;
        this.compileStart = Date.now();
      } else if (status.code === 6032) {
        // change detected
        this.failed = false;
        this.compileStart = Date.now();
        const output = Unicode.stringOutput(OutputSettings.styled());
        OutputStyle.greenBold(output);
        output.write("recompiling");
        OutputStyle.reset(output);
        output.write(" ");
        OutputStyle.yellow(output);
        output.write(this.uid);
        OutputStyle.reset(output);
        console.log(output.bind());
      } else if (status.code === 6194) {
        // complete
        if (!this.failed) {
          this.lint();
        }
        this.emittedSourceFiles.length = 0;
        if (!this.failed) {
          this.onCompileSuccess();
github swimos / swim / swim-js / swim-core-js / @swim / build / main / Target.ts View on Github external
protected onCompileResult(status: ts.Diagnostic) {
    if (status.code === 6031) {
      // watching
      this.failed = false;
      this.compileStart = Date.now();
    } else if (status.code === 6032) {
      // change detected
      this.failed = false;
      this.compileStart = Date.now();
      const output = Unicode.stringOutput(OutputSettings.styled());
      OutputStyle.greenBold(output);
      output.write("recompiling");
      OutputStyle.reset(output);
      output.write(" ");
      OutputStyle.yellow(output);
      output.write(this.uid);
      OutputStyle.reset(output);
      console.log(output.bind());
    } else if (status.code === 6194) {
      // complete
      if (!this.failed) {
        this.lint();
      }
      if (!this.failed) {
        this.onCompileSuccess();
        if (this.selected) {
github swimos / swim / swim-system-js / swim-core-js / @swim / build / main / Target.ts View on Github external
test(): Promise {
    const output = Unicode.stringOutput(OutputSettings.styled());
    OutputStyle.greenBold(output);
    output.write("testing");
    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;
    const bundleOutput = bundleConfig ? bundleConfig.output as rollup.OutputOptions : void 0;
    const outputFile = bundleOutput ? bundleOutput.file : void 0;
    const scriptPath = outputFile ? path.resolve(this.project.baseDir, outputFile) : void 0;
    if (scriptPath && fs.existsSync(scriptPath)) {
      return new Promise((resolve, reject): void => {
        const args: string[] = [];
github swimos / swim / swim-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-js / swim-core-js / @swim / build / main / Target.ts View on Github external
protected onCompileFailure() {
    this.compileStart = 0;
    const output = Unicode.stringOutput(OutputSettings.styled());
    OutputStyle.redBold(output);
    output.write("failed to compile");
    OutputStyle.reset(output);
    output.write(" ");
    OutputStyle.yellow(output);
    output.write(this.uid);
    OutputStyle.reset(output);
    console.log(output.bind());
    console.log();
  }
github swimos / swim / swim-js / swim-core-js / @swim / build / main / Target.ts View on Github external
if (code === 0) {
            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();
          } 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();
          }
          resolve(0);
        });
      });
github swimos / swim / swim-system-js / swim-core-js / @swim / build / main / Target.ts View on Github external
}
    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 onCompileFailure() {
    this.compileStart = 0;
    const output = Unicode.stringOutput(OutputSettings.styled());
    OutputStyle.redBold(output);
    output.write("failed to compile");
    OutputStyle.reset(output);
    output.write(" ");
    OutputStyle.yellow(output);
    output.write(this.uid);
    OutputStyle.reset(output);
    console.log(output.bind());
    console.log();
  }
github swimos / swim / swim-js / swim-core-js / @swim / build / main / Build.ts View on Github external
printTargets(targets: Target[] | string | undefined): void {
    if (!Array.isArray(targets)) {
      targets = this.transitiveDeps(targets);
    }
    const output = Unicode.stringOutput(OutputSettings.styled());
    OutputStyle.greenBold(output);
    output.write("targets");
    OutputStyle.reset(output);
    console.log(output.bind());
    for (let i = 0; i < targets.length; i += 1) {
      const target = targets[i];
      const output = Unicode.stringOutput(OutputSettings.styled());
      output.write(" - ");
      if (target.selected) {
        OutputStyle.yellow(output);
      }
      output.write(target.uid);
      if (target.selected) {
        OutputStyle.reset(output);
      }
      console.log(output.bind());
    }
  }
github swimos / swim / swim-js / swim-core-js / @swim / build / main / Target.ts View on Github external
protected onCompileSuccess() {
    const dt = Date.now() - this.compileStart;
    this.compileStart = 0;
    const output = Unicode.stringOutput(OutputSettings.styled());
    OutputStyle.greenBold(output);
    output.write("compiled");
    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();
  }