Skip to content

Commit

Permalink
Merge pull request #3060 from iclanton/ncl-no-const-enums
Browse files Browse the repository at this point in the history
[node-core-library] Eliminate const enums from node-core-library's public API.
  • Loading branch information
iclanton authored Dec 3, 2021
2 parents de7ddf4 + 9df7190 commit 3e081c1
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/node-core-library",
"comment": "Replace const enums with conventional enums to allow for compatability with JavaScript consumers.",
"type": "minor"
}
],
"packageName": "@rushstack/node-core-library"
}
12 changes: 6 additions & 6 deletions common/reviews/api/node-core-library.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as child_process from 'child_process';
import * as fs from 'fs';

// @public
export const enum AlreadyExistsBehavior {
export enum AlreadyExistsBehavior {
Error = "error",
Ignore = "ignore",
Overwrite = "overwrite"
Expand Down Expand Up @@ -128,7 +128,7 @@ export class ConsoleTerminalProvider implements ITerminalProvider {
}

// @public
export const enum Encoding {
export enum Encoding {
// (undocumented)
Utf8 = "utf8"
}
Expand Down Expand Up @@ -180,7 +180,7 @@ export type ExecutableStdioMapping = 'pipe' | 'ignore' | 'inherit' | ExecutableS
export type ExecutableStdioStreamMapping = 'pipe' | 'ignore' | 'inherit' | NodeJS.WritableStream | NodeJS.ReadableStream | number | undefined;

// @public
export const enum FileConstants {
export enum FileConstants {
PackageJson = "package.json"
}

Expand Down Expand Up @@ -261,7 +261,7 @@ export class FileWriter {
}

// @public
export const enum FolderConstants {
export enum FolderConstants {
Git = ".git",
NodeModules = "node_modules"
}
Expand Down Expand Up @@ -646,7 +646,7 @@ export class MapExtensions {
}

// @public
export const enum NewlineKind {
export enum NewlineKind {
CrLf = "\r\n",
Lf = "\n",
OsDefault = "os"
Expand Down Expand Up @@ -701,7 +701,7 @@ export class Path {
}

// @public
export const enum PosixModeBits {
export enum PosixModeBits {
AllExecute = 73,
AllRead = 292,
AllWrite = 146,
Expand Down
4 changes: 2 additions & 2 deletions libraries/node-core-library/src/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* @public
*/
export const enum FileConstants {
export enum FileConstants {
/**
* "package.json" - the configuration file that defines an NPM package
*/
Expand All @@ -18,7 +18,7 @@ export const enum FileConstants {
*
* @public
*/
export const enum FolderConstants {
export enum FolderConstants {
/**
* ".git" - the data storage for a Git working folder
*/
Expand Down
2 changes: 1 addition & 1 deletion libraries/node-core-library/src/FileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export interface IFileSystemCopyFileOptions extends IFileSystemCopyFileBaseOptio
*
* @public
*/
export const enum AlreadyExistsBehavior {
export enum AlreadyExistsBehavior {
/**
* If the output file path already exists, try to overwrite the existing object.
*
Expand Down
2 changes: 1 addition & 1 deletion libraries/node-core-library/src/PosixModeBits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*
* @public
*/
export const enum PosixModeBits {
export enum PosixModeBits {
// The bits

/**
Expand Down
4 changes: 2 additions & 2 deletions libraries/node-core-library/src/Text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import * as os from 'os';
* The allowed types of encodings, as supported by Node.js
* @public
*/
export const enum Encoding {
export enum Encoding {
Utf8 = 'utf8'
}

/**
* Enumeration controlling conversion of newline characters.
* @public
*/
export const enum NewlineKind {
export enum NewlineKind {
/**
* Windows-style newlines
*/
Expand Down

0 comments on commit 3e081c1

Please sign in to comment.