@skmtc/core 0.0.223 → 0.0.224
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.
- package/{script → esm}/_dnt.polyfills.js +1 -2
- package/{script → esm}/_dnt.shims.js +4 -8
- package/{script → esm}/context/CoreContext.js +24 -28
- package/{script → esm}/context/GenerateContext.js +13 -17
- package/{script → esm}/context/LogStore.js +1 -5
- package/{script → esm}/context/ParseContext.js +1 -5
- package/{script → esm}/context/RenderContext.js +17 -47
- package/{script → esm}/context/Trail.js +1 -5
- package/esm/context/types.js +1 -0
- package/{script → esm}/deps/jsr.io/@std/encoding/1.0.1/_validate_binary_like.js +1 -4
- package/{script → esm}/deps/jsr.io/@std/encoding/1.0.1/ascii85.js +4 -8
- package/{script → esm}/deps/jsr.io/@std/encoding/1.0.1/base32.js +4 -8
- package/{script → esm}/deps/jsr.io/@std/encoding/1.0.1/base58.js +4 -8
- package/{script → esm}/deps/jsr.io/@std/encoding/1.0.1/base64.js +4 -8
- package/{script → esm}/deps/jsr.io/@std/encoding/1.0.1/base64url.js +3 -30
- package/{script → esm}/deps/jsr.io/@std/encoding/1.0.1/hex.js +4 -8
- package/esm/deps/jsr.io/@std/encoding/1.0.1/mod.js +22 -0
- package/{script → esm}/deps/jsr.io/@std/encoding/1.0.1/varint.js +8 -14
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/_common/assert_path.js +1 -4
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/_common/basename.js +5 -10
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/_common/common.js +1 -4
- package/esm/deps/jsr.io/@std/path/1.0.0/_common/constants.js +46 -0
- package/esm/deps/jsr.io/@std/path/1.0.0/_common/dirname.js +8 -0
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/_common/format.js +2 -6
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/_common/from_file_url.js +1 -4
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/_common/glob_to_reg_exp.js +1 -4
- package/esm/deps/jsr.io/@std/path/1.0.0/_common/normalize.js +8 -0
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/_common/normalize_string.js +6 -9
- package/esm/deps/jsr.io/@std/path/1.0.0/_common/relative.js +9 -0
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/_common/strip_trailing_separators.js +1 -4
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/_common/to_file_url.js +1 -4
- package/esm/deps/jsr.io/@std/path/1.0.0/_os.js +14 -0
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/basename.js +7 -10
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/common.js +4 -7
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/constants.js +4 -7
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/dirname.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/extname.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/format.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/from_file_url.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/glob_to_regexp.js +7 -10
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/is_absolute.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/is_glob.js +1 -4
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/join.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/join_globs.js +7 -10
- package/esm/deps/jsr.io/@std/path/1.0.0/mod.js +54 -0
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/normalize.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/normalize_glob.js +7 -10
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/parse.js +5 -8
- package/esm/deps/jsr.io/@std/path/1.0.0/posix/_util.js +8 -0
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/basename.js +8 -11
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/constants.js +3 -6
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/dirname.js +8 -11
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/extname.js +7 -10
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/format.js +4 -7
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/from_file_url.js +3 -6
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/glob_to_regexp.js +3 -6
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/is_absolute.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/join.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/join_globs.js +7 -10
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/normalize.js +8 -11
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/normalize_glob.js +6 -9
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/parse.js +10 -13
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/relative.js +14 -17
- package/esm/deps/jsr.io/@std/path/1.0.0/posix/resolve.js +59 -0
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/to_file_url.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/posix/to_namespaced_path.js +1 -4
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/relative.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/resolve.js +7 -10
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/to_file_url.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/to_namespaced_path.js +7 -10
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/types.js +1 -2
- package/esm/deps/jsr.io/@std/path/1.0.0/windows/_util.js +15 -0
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/basename.js +11 -14
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/constants.js +3 -6
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/dirname.js +17 -20
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/extname.js +9 -12
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/format.js +4 -7
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/from_file_url.js +3 -6
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/glob_to_regexp.js +3 -6
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/is_absolute.js +9 -12
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/join.js +10 -13
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/join_globs.js +7 -10
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/normalize.js +17 -20
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/normalize_glob.js +6 -9
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/parse.js +16 -19
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/relative.js +16 -19
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/resolve.js +17 -43
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/to_file_url.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/path/1.0.0/windows/to_namespaced_path.js +11 -14
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_dumper/dumper.js +10 -36
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_dumper/dumper_state.js +2 -6
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_error.js +1 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_loader/loader.js +9 -36
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_loader/loader_state.js +2 -6
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_mark.js +3 -7
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_state.js +3 -7
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/binary.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/bool.js +4 -7
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/float.js +5 -8
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/function.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/int.js +4 -7
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/map.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/merge.js +2 -5
- package/esm/deps/jsr.io/@std/yaml/0.215.0/_type/mod.js +20 -0
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/nil.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/omap.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/pairs.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/regexp.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/seq.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/set.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/str.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/timestamp.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_type/undefined.js +2 -5
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/_utils.js +15 -32
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/mod.js +4 -20
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/parse.js +5 -9
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/schema/core.js +4 -7
- package/esm/deps/jsr.io/@std/yaml/0.215.0/schema/default.js +15 -0
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/schema/extended.js +6 -9
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/schema/failsafe.js +4 -7
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/schema/json.js +6 -9
- package/esm/deps/jsr.io/@std/yaml/0.215.0/schema/mod.js +10 -0
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/schema.js +3 -7
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/stringify.js +3 -6
- package/{script → esm}/deps/jsr.io/@std/yaml/0.215.0/type.js +1 -5
- package/{script → esm}/dsl/ContentSettings.js +1 -5
- package/{script → esm}/dsl/Definition.js +4 -8
- package/{script → esm}/dsl/GeneratedValueList.js +3 -7
- package/{script → esm}/dsl/Identifier.js +8 -12
- package/{script → esm}/dsl/Import.js +2 -7
- package/esm/dsl/ModelCreator.js +1 -0
- package/{script → esm}/dsl/ModelDriver.js +14 -18
- package/esm/dsl/OperationCreator.js +1 -0
- package/{script → esm}/dsl/OperationDriver.js +11 -15
- package/esm/dsl/Stringable.js +1 -0
- package/{script → esm}/dsl/ValueBase.js +1 -5
- package/{script → esm}/dsl/base.js +5 -13
- package/esm/dsl/constants.js +1 -0
- package/{script → esm}/dsl/withConfig.js +9 -15
- package/esm/generate/generate.js +47 -0
- package/esm/generate/generateModels.js +29 -0
- package/esm/generate/generateOperations.js +35 -0
- package/{script → esm}/helpers/logStatus.js +2 -7
- package/esm/helpers/naming.js +25 -0
- package/esm/helpers/refFns.js +24 -0
- package/esm/helpers/strings.js +6 -0
- package/{script → esm}/helpers/verifyType.js +1 -4
- package/esm/mod.js +61 -0
- package/{script → esm}/oas/array/Array.js +2 -6
- package/esm/oas/array/array-types.js +17 -0
- package/esm/oas/array/toArray.js +20 -0
- package/{script → esm}/oas/boolean/Boolean.js +2 -6
- package/esm/oas/boolean/boolean-types.js +8 -0
- package/esm/oas/boolean/toBoolean.js +10 -0
- package/{script → esm}/oas/components/Components.js +2 -6
- package/esm/oas/components/toComponentsV3.js +44 -0
- package/esm/oas/contact/contact-types.js +7 -0
- package/{script → esm}/oas/discriminator/Discriminator.js +2 -6
- package/esm/oas/discriminator/discriminator-types.js +6 -0
- package/esm/oas/discriminator/toDiscriminatorV3.js +11 -0
- package/{script → esm}/oas/document/Document.js +2 -6
- package/esm/oas/document/toDocumentV3.js +24 -0
- package/{script → esm}/oas/example/Example.js +2 -6
- package/esm/oas/example/example-types.js +9 -0
- package/esm/oas/example/toExamplesV3.js +45 -0
- package/{script → esm}/oas/header/Header.js +2 -6
- package/esm/oas/header/toHeadersV3.js +42 -0
- package/{script → esm}/oas/info/Info.js +2 -6
- package/{script → esm}/oas/info/toInfoV3.js +3 -7
- package/{script → esm}/oas/integer/Integer.js +2 -6
- package/esm/oas/integer/integer-types.js +18 -0
- package/esm/oas/integer/toInteger.js +13 -0
- package/{script → esm}/oas/intersection/Intersection.js +2 -6
- package/esm/oas/intersection/intersection-types.js +12 -0
- package/esm/oas/intersection/toIntersection.js +22 -0
- package/esm/oas/license/license-types.js +7 -0
- package/esm/oas/markdown/markdown-types.js +2 -0
- package/{script → esm}/oas/mediaType/MediaType.js +2 -6
- package/esm/oas/mediaType/mediaType-types.js +12 -0
- package/esm/oas/mediaType/toMediaTypeItemV3.js +37 -0
- package/esm/oas/null/null-types.js +8 -0
- package/{script → esm}/oas/number/Number.js +2 -6
- package/esm/oas/number/number-types.js +14 -0
- package/esm/oas/number/toNumber.js +10 -0
- package/{script → esm}/oas/object/Object.js +4 -8
- package/esm/oas/object/object-types.js +27 -0
- package/esm/oas/object/toAdditionalPropertiesV3.js +14 -0
- package/esm/oas/object/toObject.js +23 -0
- package/{script → esm}/oas/operation/Operation.js +2 -6
- package/{script → esm}/oas/operation/toOperationsV3.js +13 -18
- package/{script → esm}/oas/parameter/Parameter.js +2 -6
- package/esm/oas/parameter/parameter-types.js +38 -0
- package/{script → esm}/oas/parameter/toParameterV3.js +22 -28
- package/{script → esm}/oas/pathItem/PathItem.js +2 -6
- package/esm/oas/pathItem/toPathItemV3.js +15 -0
- package/{script → esm}/oas/ref/Ref.js +6 -10
- package/esm/oas/ref/ref-types.js +54 -0
- package/esm/oas/ref/toRefV31.js +11 -0
- package/{script → esm}/oas/requestBody/RequestBody.js +2 -6
- package/esm/oas/requestBody/toRequestBodiesV3.js +46 -0
- package/{script → esm}/oas/response/Response.js +2 -6
- package/esm/oas/response/toResponseV3.js +35 -0
- package/esm/oas/schema/Schema.js +1 -0
- package/esm/oas/schema/schema-types.js +23 -0
- package/esm/oas/schema/toSchemasV3.js +60 -0
- package/{script → esm}/oas/string/String.js +2 -6
- package/esm/oas/string/string-types.js +29 -0
- package/esm/oas/string/toString.js +11 -0
- package/{script → esm}/oas/tag/Tag.js +2 -6
- package/esm/oas/tag/toTagsV3.js +14 -0
- package/{script → esm}/oas/union/Union.js +2 -6
- package/esm/oas/union/toUnion.js +22 -0
- package/esm/oas/union/union-types.js +12 -0
- package/{script → esm}/oas/unknown/Unknown.js +2 -6
- package/esm/oas/unknown/toUnknown.js +9 -0
- package/esm/oas/unknown/unknown-types.js +8 -0
- package/{script → esm}/oas/void/Void.js +4 -8
- package/{script → esm}/oas-elements/OasBase.js +1 -5
- package/esm/package.json +3 -0
- package/esm/parse/parse.js +16 -0
- package/{script → esm}/schemas/client.js +2 -4
- package/{script → esm}/server/createServer.js +24 -51
- package/esm/types/Brand.js +1 -0
- package/{script → esm}/types/CustomValue.js +3 -8
- package/esm/types/GeneratedValue.js +1 -0
- package/{script → esm}/types/GenerationType.js +1 -2
- package/esm/types/GeneratorKeys.js +13 -0
- package/esm/types/Method.js +31 -0
- package/esm/types/Modifiers.js +1 -0
- package/esm/types/RefName.js +1 -0
- package/esm/types/Settings.js +42 -0
- package/esm/types/TypeSystem.js +1 -0
- package/esm/types/prettierConfig.js +46 -0
- package/{script → esm}/typescript/EntityType.js +3 -7
- package/{script → esm}/typescript/FunctionParameter.js +10 -17
- package/{script → esm}/typescript/ReactRouterPathParams.js +2 -6
- package/esm/typescript/identifiers.js +7 -0
- package/esm/typescript/keyValues.js +11 -0
- package/{script → esm}/typescript/toDestructuredObject.js +1 -5
- package/{script → esm}/typescript/toOperationArg.js +7 -14
- package/esm/typescript/toOperationResponse.js +17 -0
- package/esm/typescript/toParamsObject.js +12 -0
- package/esm/typescript/toPathTemplate.js +3 -0
- package/esm/typescript/withDescription.js +3 -0
- package/package.json +8 -8
- package/script/context/types.js +0 -2
- package/script/deps/jsr.io/@std/encoding/1.0.1/mod.js +0 -38
- package/script/deps/jsr.io/@std/path/1.0.0/_common/constants.js +0 -49
- package/script/deps/jsr.io/@std/path/1.0.0/_common/dirname.js +0 -11
- package/script/deps/jsr.io/@std/path/1.0.0/_common/normalize.js +0 -11
- package/script/deps/jsr.io/@std/path/1.0.0/_common/relative.js +0 -12
- package/script/deps/jsr.io/@std/path/1.0.0/_os.js +0 -40
- package/script/deps/jsr.io/@std/path/1.0.0/mod.js +0 -70
- package/script/deps/jsr.io/@std/path/1.0.0/posix/_util.js +0 -11
- package/script/deps/jsr.io/@std/path/1.0.0/posix/resolve.js +0 -85
- package/script/deps/jsr.io/@std/path/1.0.0/windows/_util.js +0 -20
- package/script/deps/jsr.io/@std/yaml/0.215.0/_type/mod.js +0 -39
- package/script/deps/jsr.io/@std/yaml/0.215.0/schema/default.js +0 -18
- package/script/deps/jsr.io/@std/yaml/0.215.0/schema/mod.js +0 -18
- package/script/dsl/ModelCreator.js +0 -2
- package/script/dsl/OperationCreator.js +0 -2
- package/script/dsl/Stringable.js +0 -2
- package/script/dsl/constants.js +0 -4
- package/script/generate/generate.js +0 -75
- package/script/generate/generateModels.js +0 -56
- package/script/generate/generateOperations.js +0 -62
- package/script/helpers/naming.js +0 -33
- package/script/helpers/refFns.js +0 -30
- package/script/helpers/strings.js +0 -11
- package/script/mod.js +0 -77
- package/script/oas/array/array-types.js +0 -20
- package/script/oas/array/toArray.js +0 -24
- package/script/oas/boolean/boolean-types.js +0 -11
- package/script/oas/boolean/toBoolean.js +0 -14
- package/script/oas/components/toComponentsV3.js +0 -48
- package/script/oas/contact/contact-types.js +0 -10
- package/script/oas/discriminator/discriminator-types.js +0 -9
- package/script/oas/discriminator/toDiscriminatorV3.js +0 -15
- package/script/oas/document/toDocumentV3.js +0 -28
- package/script/oas/example/example-types.js +0 -12
- package/script/oas/example/toExamplesV3.js +0 -51
- package/script/oas/header/toHeadersV3.js +0 -46
- package/script/oas/integer/integer-types.js +0 -21
- package/script/oas/integer/toInteger.js +0 -17
- package/script/oas/intersection/intersection-types.js +0 -15
- package/script/oas/intersection/toIntersection.js +0 -26
- package/script/oas/license/license-types.js +0 -10
- package/script/oas/markdown/markdown-types.js +0 -5
- package/script/oas/mediaType/mediaType-types.js +0 -15
- package/script/oas/mediaType/toMediaTypeItemV3.js +0 -43
- package/script/oas/null/null-types.js +0 -11
- package/script/oas/number/number-types.js +0 -17
- package/script/oas/number/toNumber.js +0 -14
- package/script/oas/object/object-types.js +0 -30
- package/script/oas/object/toAdditionalPropertiesV3.js +0 -18
- package/script/oas/object/toObject.js +0 -27
- package/script/oas/parameter/parameter-types.js +0 -41
- package/script/oas/pathItem/toPathItemV3.js +0 -19
- package/script/oas/ref/ref-types.js +0 -57
- package/script/oas/ref/toRefV31.js +0 -15
- package/script/oas/requestBody/toRequestBodiesV3.js +0 -51
- package/script/oas/response/toResponseV3.js +0 -41
- package/script/oas/schema/Schema.js +0 -2
- package/script/oas/schema/schema-types.js +0 -26
- package/script/oas/schema/toSchemasV3.js +0 -67
- package/script/oas/string/string-types.js +0 -32
- package/script/oas/string/toString.js +0 -15
- package/script/oas/tag/toTagsV3.js +0 -18
- package/script/oas/union/toUnion.js +0 -26
- package/script/oas/union/union-types.js +0 -15
- package/script/oas/unknown/toUnknown.js +0 -13
- package/script/oas/unknown/unknown-types.js +0 -11
- package/script/package.json +0 -3
- package/script/parse/parse.js +0 -20
- package/script/types/Brand.js +0 -2
- package/script/types/GeneratedValue.js +0 -2
- package/script/types/GeneratorKeys.js +0 -19
- package/script/types/Method.js +0 -34
- package/script/types/Modifiers.js +0 -2
- package/script/types/RefName.js +0 -2
- package/script/types/Settings.js +0 -45
- package/script/types/TypeSystem.js +0 -2
- package/script/types/prettierConfig.js +0 -49
- package/script/typescript/identifiers.js +0 -12
- package/script/typescript/keyValues.js +0 -15
- package/script/typescript/toOperationResponse.js +0 -21
- package/script/typescript/toParamsObject.js +0 -16
- package/script/typescript/toPathTemplate.js +0 -7
- package/script/typescript/withDescription.js +0 -7
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
2
|
// This module is browser compatible.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const assert_path_js_1 = require("../_common/assert_path.js");
|
|
9
|
-
const _util_js_1 = require("./_util.js");
|
|
3
|
+
import { CHAR_DOT } from "../_common/constants.js";
|
|
4
|
+
import { stripTrailingSeparators } from "../_common/strip_trailing_separators.js";
|
|
5
|
+
import { assertPath } from "../_common/assert_path.js";
|
|
6
|
+
import { isPosixPathSeparator } from "./_util.js";
|
|
10
7
|
/**
|
|
11
8
|
* Return a `ParsedPath` object of the `path`.
|
|
12
9
|
*
|
|
@@ -28,12 +25,12 @@ const _util_js_1 = require("./_util.js");
|
|
|
28
25
|
* @param path The path to parse.
|
|
29
26
|
* @returns The parsed path object.
|
|
30
27
|
*/
|
|
31
|
-
function parse(path) {
|
|
32
|
-
|
|
28
|
+
export function parse(path) {
|
|
29
|
+
assertPath(path);
|
|
33
30
|
const ret = { root: "", dir: "", base: "", ext: "", name: "" };
|
|
34
31
|
if (path.length === 0)
|
|
35
32
|
return ret;
|
|
36
|
-
const isAbsolute =
|
|
33
|
+
const isAbsolute = isPosixPathSeparator(path.charCodeAt(0));
|
|
37
34
|
let start;
|
|
38
35
|
if (isAbsolute) {
|
|
39
36
|
ret.root = "/";
|
|
@@ -53,7 +50,7 @@ function parse(path) {
|
|
|
53
50
|
// Get non-dir info
|
|
54
51
|
for (; i >= start; --i) {
|
|
55
52
|
const code = path.charCodeAt(i);
|
|
56
|
-
if (
|
|
53
|
+
if (isPosixPathSeparator(code)) {
|
|
57
54
|
// If we reached a path separator that was not part of a set of path
|
|
58
55
|
// separators at the end of the string, stop now
|
|
59
56
|
if (!matchedSlash) {
|
|
@@ -68,7 +65,7 @@ function parse(path) {
|
|
|
68
65
|
matchedSlash = false;
|
|
69
66
|
end = i + 1;
|
|
70
67
|
}
|
|
71
|
-
if (code ===
|
|
68
|
+
if (code === CHAR_DOT) {
|
|
72
69
|
// If this is our first dot, mark it as the start of our extension
|
|
73
70
|
if (startDot === -1)
|
|
74
71
|
startDot = i;
|
|
@@ -110,7 +107,7 @@ function parse(path) {
|
|
|
110
107
|
ret.ext = path.slice(startDot, end);
|
|
111
108
|
}
|
|
112
109
|
if (startPart > 0) {
|
|
113
|
-
ret.dir =
|
|
110
|
+
ret.dir = stripTrailingSeparators(path.slice(0, startPart - 1), isPosixPathSeparator);
|
|
114
111
|
}
|
|
115
112
|
else if (isAbsolute)
|
|
116
113
|
ret.dir = "/";
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
2
|
// This module is browser compatible.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const resolve_js_1 = require("./resolve.js");
|
|
8
|
-
const relative_js_1 = require("../_common/relative.js");
|
|
3
|
+
import { isPosixPathSeparator } from "./_util.js";
|
|
4
|
+
import { resolve } from "./resolve.js";
|
|
5
|
+
import { assertArgs } from "../_common/relative.js";
|
|
9
6
|
/**
|
|
10
7
|
* Return the relative path from `from` to `to` based on current working directory.
|
|
11
8
|
*
|
|
@@ -24,17 +21,17 @@ const relative_js_1 = require("../_common/relative.js");
|
|
|
24
21
|
* @param to The path to reach.
|
|
25
22
|
* @returns The relative path.
|
|
26
23
|
*/
|
|
27
|
-
function relative(from, to) {
|
|
28
|
-
|
|
29
|
-
from =
|
|
30
|
-
to =
|
|
24
|
+
export function relative(from, to) {
|
|
25
|
+
assertArgs(from, to);
|
|
26
|
+
from = resolve(from);
|
|
27
|
+
to = resolve(to);
|
|
31
28
|
if (from === to)
|
|
32
29
|
return "";
|
|
33
30
|
// Trim any leading backslashes
|
|
34
31
|
let fromStart = 1;
|
|
35
32
|
const fromEnd = from.length;
|
|
36
33
|
for (; fromStart < fromEnd; ++fromStart) {
|
|
37
|
-
if (!
|
|
34
|
+
if (!isPosixPathSeparator(from.charCodeAt(fromStart)))
|
|
38
35
|
break;
|
|
39
36
|
}
|
|
40
37
|
const fromLen = fromEnd - fromStart;
|
|
@@ -42,7 +39,7 @@ function relative(from, to) {
|
|
|
42
39
|
let toStart = 1;
|
|
43
40
|
const toEnd = to.length;
|
|
44
41
|
for (; toStart < toEnd; ++toStart) {
|
|
45
|
-
if (!
|
|
42
|
+
if (!isPosixPathSeparator(to.charCodeAt(toStart)))
|
|
46
43
|
break;
|
|
47
44
|
}
|
|
48
45
|
const toLen = toEnd - toStart;
|
|
@@ -53,7 +50,7 @@ function relative(from, to) {
|
|
|
53
50
|
for (; i <= length; ++i) {
|
|
54
51
|
if (i === length) {
|
|
55
52
|
if (toLen > length) {
|
|
56
|
-
if (
|
|
53
|
+
if (isPosixPathSeparator(to.charCodeAt(toStart + i))) {
|
|
57
54
|
// We get here if `from` is the exact base path for `to`.
|
|
58
55
|
// For example: from='/foo/bar'; to='/foo/bar/baz'
|
|
59
56
|
return to.slice(toStart + i + 1);
|
|
@@ -65,7 +62,7 @@ function relative(from, to) {
|
|
|
65
62
|
}
|
|
66
63
|
}
|
|
67
64
|
else if (fromLen > length) {
|
|
68
|
-
if (
|
|
65
|
+
if (isPosixPathSeparator(from.charCodeAt(fromStart + i))) {
|
|
69
66
|
// We get here if `to` is the exact base path for `from`.
|
|
70
67
|
// For example: from='/foo/bar/baz'; to='/foo/bar'
|
|
71
68
|
lastCommonSep = i;
|
|
@@ -82,14 +79,14 @@ function relative(from, to) {
|
|
|
82
79
|
const toCode = to.charCodeAt(toStart + i);
|
|
83
80
|
if (fromCode !== toCode)
|
|
84
81
|
break;
|
|
85
|
-
else if (
|
|
82
|
+
else if (isPosixPathSeparator(fromCode))
|
|
86
83
|
lastCommonSep = i;
|
|
87
84
|
}
|
|
88
85
|
let out = "";
|
|
89
86
|
// Generate the relative path based on the path difference between `to`
|
|
90
87
|
// and `from`
|
|
91
88
|
for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
|
|
92
|
-
if (i === fromEnd ||
|
|
89
|
+
if (i === fromEnd || isPosixPathSeparator(from.charCodeAt(i))) {
|
|
93
90
|
if (out.length === 0)
|
|
94
91
|
out += "..";
|
|
95
92
|
else
|
|
@@ -102,7 +99,7 @@ function relative(from, to) {
|
|
|
102
99
|
return out + to.slice(toStart + lastCommonSep);
|
|
103
100
|
else {
|
|
104
101
|
toStart += lastCommonSep;
|
|
105
|
-
if (
|
|
102
|
+
if (isPosixPathSeparator(to.charCodeAt(toStart)))
|
|
106
103
|
++toStart;
|
|
107
104
|
return to.slice(toStart);
|
|
108
105
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import * as dntShim from "../../../../../../_dnt.shims.js";
|
|
4
|
+
import { normalizeString } from "../_common/normalize_string.js";
|
|
5
|
+
import { assertPath } from "../_common/assert_path.js";
|
|
6
|
+
import { isPosixPathSeparator } from "./_util.js";
|
|
7
|
+
/**
|
|
8
|
+
* Resolves path segments into a `path`.
|
|
9
|
+
*
|
|
10
|
+
* @example Usage
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { resolve } from "@std/path/posix/resolve";
|
|
13
|
+
* import { assertEquals } from "@std/assert";
|
|
14
|
+
*
|
|
15
|
+
* const path = resolve("/foo", "bar", "baz/asdf", "quux", "..");
|
|
16
|
+
* assertEquals(path, "/foo/bar/baz/asdf");
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param pathSegments The path segments to resolve.
|
|
20
|
+
* @returns The resolved path.
|
|
21
|
+
*/
|
|
22
|
+
export function resolve(...pathSegments) {
|
|
23
|
+
let resolvedPath = "";
|
|
24
|
+
let resolvedAbsolute = false;
|
|
25
|
+
for (let i = pathSegments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
26
|
+
let path;
|
|
27
|
+
if (i >= 0)
|
|
28
|
+
path = pathSegments[i];
|
|
29
|
+
else {
|
|
30
|
+
// deno-lint-ignore no-explicit-any
|
|
31
|
+
const { Deno } = dntShim.dntGlobalThis;
|
|
32
|
+
if (typeof Deno?.cwd !== "function") {
|
|
33
|
+
throw new TypeError("Resolved a relative path without a CWD.");
|
|
34
|
+
}
|
|
35
|
+
path = Deno.cwd();
|
|
36
|
+
}
|
|
37
|
+
assertPath(path);
|
|
38
|
+
// Skip empty entries
|
|
39
|
+
if (path.length === 0) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
43
|
+
resolvedAbsolute = isPosixPathSeparator(path.charCodeAt(0));
|
|
44
|
+
}
|
|
45
|
+
// At this point the path should be resolved to a full absolute path, but
|
|
46
|
+
// handle relative paths to be safe (might happen when Deno.cwd() fails)
|
|
47
|
+
// Normalize the path
|
|
48
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute, "/", isPosixPathSeparator);
|
|
49
|
+
if (resolvedAbsolute) {
|
|
50
|
+
if (resolvedPath.length > 0)
|
|
51
|
+
return `/${resolvedPath}`;
|
|
52
|
+
else
|
|
53
|
+
return "/";
|
|
54
|
+
}
|
|
55
|
+
else if (resolvedPath.length > 0)
|
|
56
|
+
return resolvedPath;
|
|
57
|
+
else
|
|
58
|
+
return ".";
|
|
59
|
+
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
2
|
// This module is browser compatible.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const to_file_url_js_1 = require("../_common/to_file_url.js");
|
|
7
|
-
const is_absolute_js_1 = require("./is_absolute.js");
|
|
3
|
+
import { encodeWhitespace } from "../_common/to_file_url.js";
|
|
4
|
+
import { isAbsolute } from "./is_absolute.js";
|
|
8
5
|
/**
|
|
9
6
|
* Converts a path string to a file URL.
|
|
10
7
|
*
|
|
@@ -20,11 +17,11 @@ const is_absolute_js_1 = require("./is_absolute.js");
|
|
|
20
17
|
* @param path The path to convert.
|
|
21
18
|
* @returns The file URL.
|
|
22
19
|
*/
|
|
23
|
-
function toFileUrl(path) {
|
|
24
|
-
if (!
|
|
20
|
+
export function toFileUrl(path) {
|
|
21
|
+
if (!isAbsolute(path)) {
|
|
25
22
|
throw new TypeError("Must be an absolute path.");
|
|
26
23
|
}
|
|
27
24
|
const url = new URL("file:///");
|
|
28
|
-
url.pathname =
|
|
25
|
+
url.pathname = encodeWhitespace(path.replace(/%/g, "%25").replace(/\\/g, "%5C"));
|
|
29
26
|
return url;
|
|
30
27
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
2
|
// This module is browser compatible.
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.toNamespacedPath = toNamespacedPath;
|
|
6
3
|
/**
|
|
7
4
|
* Converts a path to a namespaced path. This function returns the path as is on posix.
|
|
8
5
|
*
|
|
@@ -17,7 +14,7 @@ exports.toNamespacedPath = toNamespacedPath;
|
|
|
17
14
|
* @param path The path.
|
|
18
15
|
* @returns The namespaced path.
|
|
19
16
|
*/
|
|
20
|
-
function toNamespacedPath(path) {
|
|
17
|
+
export function toNamespacedPath(path) {
|
|
21
18
|
// Non-op on posix systems
|
|
22
19
|
return path;
|
|
23
20
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
2
|
// This module is browser compatible.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const relative_js_1 = require("./posix/relative.js");
|
|
8
|
-
const relative_js_2 = require("./windows/relative.js");
|
|
3
|
+
import { isWindows } from "./_os.js";
|
|
4
|
+
import { relative as posixRelative } from "./posix/relative.js";
|
|
5
|
+
import { relative as windowsRelative } from "./windows/relative.js";
|
|
9
6
|
/**
|
|
10
7
|
* Return the relative path from `from` to `to` based on current working
|
|
11
8
|
* directory.
|
|
@@ -28,6 +25,6 @@ const relative_js_2 = require("./windows/relative.js");
|
|
|
28
25
|
* @param to Path in current working directory.
|
|
29
26
|
* @returns The relative path from `from` to `to`.
|
|
30
27
|
*/
|
|
31
|
-
function relative(from, to) {
|
|
32
|
-
return
|
|
28
|
+
export function relative(from, to) {
|
|
29
|
+
return isWindows ? windowsRelative(from, to) : posixRelative(from, to);
|
|
33
30
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
2
|
// This module is browser compatible.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const resolve_js_1 = require("./posix/resolve.js");
|
|
8
|
-
const resolve_js_2 = require("./windows/resolve.js");
|
|
3
|
+
import { isWindows } from "./_os.js";
|
|
4
|
+
import { resolve as posixResolve } from "./posix/resolve.js";
|
|
5
|
+
import { resolve as windowsResolve } from "./windows/resolve.js";
|
|
9
6
|
/**
|
|
10
7
|
* Resolves path segments into a path.
|
|
11
8
|
*
|
|
@@ -26,8 +23,8 @@ const resolve_js_2 = require("./windows/resolve.js");
|
|
|
26
23
|
* @param pathSegments Path segments to process to path.
|
|
27
24
|
* @returns The resolved path.
|
|
28
25
|
*/
|
|
29
|
-
function resolve(...pathSegments) {
|
|
30
|
-
return
|
|
31
|
-
? (
|
|
32
|
-
: (
|
|
26
|
+
export function resolve(...pathSegments) {
|
|
27
|
+
return isWindows
|
|
28
|
+
? windowsResolve(...pathSegments)
|
|
29
|
+
: posixResolve(...pathSegments);
|
|
33
30
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
2
|
// This module is browser compatible.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const to_file_url_js_1 = require("./posix/to_file_url.js");
|
|
8
|
-
const to_file_url_js_2 = require("./windows/to_file_url.js");
|
|
3
|
+
import { isWindows } from "./_os.js";
|
|
4
|
+
import { toFileUrl as posixToFileUrl } from "./posix/to_file_url.js";
|
|
5
|
+
import { toFileUrl as windowsToFileUrl } from "./windows/to_file_url.js";
|
|
9
6
|
/**
|
|
10
7
|
* Converts a path string to a file URL.
|
|
11
8
|
*
|
|
@@ -26,6 +23,6 @@ const to_file_url_js_2 = require("./windows/to_file_url.js");
|
|
|
26
23
|
* @param path Path to convert to file URL.
|
|
27
24
|
* @returns The file URL equivalent to the path.
|
|
28
25
|
*/
|
|
29
|
-
function toFileUrl(path) {
|
|
30
|
-
return
|
|
26
|
+
export function toFileUrl(path) {
|
|
27
|
+
return isWindows ? windowsToFileUrl(path) : posixToFileUrl(path);
|
|
31
28
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
2
|
// This module is browser compatible.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const to_namespaced_path_js_1 = require("./posix/to_namespaced_path.js");
|
|
8
|
-
const to_namespaced_path_js_2 = require("./windows/to_namespaced_path.js");
|
|
3
|
+
import { isWindows } from "./_os.js";
|
|
4
|
+
import { toNamespacedPath as posixToNamespacedPath } from "./posix/to_namespaced_path.js";
|
|
5
|
+
import { toNamespacedPath as windowsToNamespacedPath } from "./windows/to_namespaced_path.js";
|
|
9
6
|
/**
|
|
10
7
|
* Resolves path to a namespace path. This is a no-op on
|
|
11
8
|
* non-windows systems.
|
|
@@ -25,8 +22,8 @@ const to_namespaced_path_js_2 = require("./windows/to_namespaced_path.js");
|
|
|
25
22
|
* @param path Path to resolve to namespace.
|
|
26
23
|
* @returns The resolved namespace path.
|
|
27
24
|
*/
|
|
28
|
-
function toNamespacedPath(path) {
|
|
29
|
-
return
|
|
30
|
-
? (
|
|
31
|
-
: (
|
|
25
|
+
export function toNamespacedPath(path) {
|
|
26
|
+
return isWindows
|
|
27
|
+
? windowsToNamespacedPath(path)
|
|
28
|
+
: posixToNamespacedPath(path);
|
|
32
29
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
// Copyright the Browserify authors. MIT License.
|
|
3
|
+
// Ported from https://github.com/browserify/path-browserify/
|
|
4
|
+
// This module is browser compatible.
|
|
5
|
+
import { CHAR_BACKWARD_SLASH, CHAR_FORWARD_SLASH, CHAR_LOWERCASE_A, CHAR_LOWERCASE_Z, CHAR_UPPERCASE_A, CHAR_UPPERCASE_Z, } from "../_common/constants.js";
|
|
6
|
+
export function isPosixPathSeparator(code) {
|
|
7
|
+
return code === CHAR_FORWARD_SLASH;
|
|
8
|
+
}
|
|
9
|
+
export function isPathSeparator(code) {
|
|
10
|
+
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
11
|
+
}
|
|
12
|
+
export function isWindowsDeviceRoot(code) {
|
|
13
|
+
return ((code >= CHAR_LOWERCASE_A && code <= CHAR_LOWERCASE_Z) ||
|
|
14
|
+
(code >= CHAR_UPPERCASE_A && code <= CHAR_UPPERCASE_Z));
|
|
15
|
+
}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
2
|
// This module is browser compatible.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const strip_trailing_separators_js_1 = require("../_common/strip_trailing_separators.js");
|
|
9
|
-
const _util_js_1 = require("./_util.js");
|
|
3
|
+
import { assertArgs, lastPathSegment, stripSuffix, } from "../_common/basename.js";
|
|
4
|
+
import { CHAR_COLON } from "../_common/constants.js";
|
|
5
|
+
import { stripTrailingSeparators } from "../_common/strip_trailing_separators.js";
|
|
6
|
+
import { isPathSeparator, isWindowsDeviceRoot } from "./_util.js";
|
|
10
7
|
/**
|
|
11
8
|
* Return the last portion of a `path`.
|
|
12
9
|
* Trailing directory separators are ignored, and optional suffix is removed.
|
|
@@ -25,20 +22,20 @@ const _util_js_1 = require("./_util.js");
|
|
|
25
22
|
* @param suffix The suffix to remove from extracted name.
|
|
26
23
|
* @returns The extracted name.
|
|
27
24
|
*/
|
|
28
|
-
function basename(path, suffix = "") {
|
|
29
|
-
|
|
25
|
+
export function basename(path, suffix = "") {
|
|
26
|
+
assertArgs(path, suffix);
|
|
30
27
|
// Check for a drive letter prefix so as not to mistake the following
|
|
31
28
|
// path separator as an extra separator at the end of the path that can be
|
|
32
29
|
// disregarded
|
|
33
30
|
let start = 0;
|
|
34
31
|
if (path.length >= 2) {
|
|
35
32
|
const drive = path.charCodeAt(0);
|
|
36
|
-
if (
|
|
37
|
-
if (path.charCodeAt(1) ===
|
|
33
|
+
if (isWindowsDeviceRoot(drive)) {
|
|
34
|
+
if (path.charCodeAt(1) === CHAR_COLON)
|
|
38
35
|
start = 2;
|
|
39
36
|
}
|
|
40
37
|
}
|
|
41
|
-
const lastSegment =
|
|
42
|
-
const strippedSegment =
|
|
43
|
-
return suffix ?
|
|
38
|
+
const lastSegment = lastPathSegment(path, isPathSeparator, start);
|
|
39
|
+
const strippedSegment = stripTrailingSeparators(lastSegment, isPathSeparator);
|
|
40
|
+
return suffix ? stripSuffix(strippedSegment, suffix) : strippedSegment;
|
|
44
41
|
}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
2
|
// This module is browser compatible.
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.SEPARATOR_PATTERN = exports.SEPARATOR = exports.DELIMITER = void 0;
|
|
6
3
|
/**
|
|
7
4
|
* The character used to separate entries in the PATH environment variable.
|
|
8
5
|
*/
|
|
9
|
-
|
|
6
|
+
export const DELIMITER = ";";
|
|
10
7
|
/**
|
|
11
8
|
* The character used to separate components of a file path.
|
|
12
9
|
*/
|
|
13
|
-
|
|
10
|
+
export const SEPARATOR = "\\";
|
|
14
11
|
/**
|
|
15
12
|
* A regular expression that matches one or more path separators.
|
|
16
13
|
*/
|
|
17
|
-
|
|
14
|
+
export const SEPARATOR_PATTERN = /[\\/]+/;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
2
|
// This module is browser compatible.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const strip_trailing_separators_js_1 = require("../_common/strip_trailing_separators.js");
|
|
9
|
-
const _util_js_1 = require("./_util.js");
|
|
3
|
+
import { assertArg } from "../_common/dirname.js";
|
|
4
|
+
import { CHAR_COLON } from "../_common/constants.js";
|
|
5
|
+
import { stripTrailingSeparators } from "../_common/strip_trailing_separators.js";
|
|
6
|
+
import { isPathSeparator, isPosixPathSeparator, isWindowsDeviceRoot, } from "./_util.js";
|
|
10
7
|
/**
|
|
11
8
|
* Return the directory path of a `path`.
|
|
12
9
|
*
|
|
@@ -22,8 +19,8 @@ const _util_js_1 = require("./_util.js");
|
|
|
22
19
|
* @param path The path to get the directory from.
|
|
23
20
|
* @returns The directory path.
|
|
24
21
|
*/
|
|
25
|
-
function dirname(path) {
|
|
26
|
-
|
|
22
|
+
export function dirname(path) {
|
|
23
|
+
assertArg(path);
|
|
27
24
|
const len = path.length;
|
|
28
25
|
let rootEnd = -1;
|
|
29
26
|
let end = -1;
|
|
@@ -32,16 +29,16 @@ function dirname(path) {
|
|
|
32
29
|
const code = path.charCodeAt(0);
|
|
33
30
|
// Try to match a root
|
|
34
31
|
if (len > 1) {
|
|
35
|
-
if (
|
|
32
|
+
if (isPathSeparator(code)) {
|
|
36
33
|
// Possible UNC root
|
|
37
34
|
rootEnd = offset = 1;
|
|
38
|
-
if (
|
|
35
|
+
if (isPathSeparator(path.charCodeAt(1))) {
|
|
39
36
|
// Matched double path separator at beginning
|
|
40
37
|
let j = 2;
|
|
41
38
|
let last = j;
|
|
42
39
|
// Match 1 or more non-path separators
|
|
43
40
|
for (; j < len; ++j) {
|
|
44
|
-
if (
|
|
41
|
+
if (isPathSeparator(path.charCodeAt(j)))
|
|
45
42
|
break;
|
|
46
43
|
}
|
|
47
44
|
if (j < len && j !== last) {
|
|
@@ -49,7 +46,7 @@ function dirname(path) {
|
|
|
49
46
|
last = j;
|
|
50
47
|
// Match 1 or more path separators
|
|
51
48
|
for (; j < len; ++j) {
|
|
52
|
-
if (!
|
|
49
|
+
if (!isPathSeparator(path.charCodeAt(j)))
|
|
53
50
|
break;
|
|
54
51
|
}
|
|
55
52
|
if (j < len && j !== last) {
|
|
@@ -57,7 +54,7 @@ function dirname(path) {
|
|
|
57
54
|
last = j;
|
|
58
55
|
// Match 1 or more non-path separators
|
|
59
56
|
for (; j < len; ++j) {
|
|
60
|
-
if (
|
|
57
|
+
if (isPathSeparator(path.charCodeAt(j)))
|
|
61
58
|
break;
|
|
62
59
|
}
|
|
63
60
|
if (j === len) {
|
|
@@ -74,24 +71,24 @@ function dirname(path) {
|
|
|
74
71
|
}
|
|
75
72
|
}
|
|
76
73
|
}
|
|
77
|
-
else if (
|
|
74
|
+
else if (isWindowsDeviceRoot(code)) {
|
|
78
75
|
// Possible device root
|
|
79
|
-
if (path.charCodeAt(1) ===
|
|
76
|
+
if (path.charCodeAt(1) === CHAR_COLON) {
|
|
80
77
|
rootEnd = offset = 2;
|
|
81
78
|
if (len > 2) {
|
|
82
|
-
if (
|
|
79
|
+
if (isPathSeparator(path.charCodeAt(2)))
|
|
83
80
|
rootEnd = offset = 3;
|
|
84
81
|
}
|
|
85
82
|
}
|
|
86
83
|
}
|
|
87
84
|
}
|
|
88
|
-
else if (
|
|
85
|
+
else if (isPathSeparator(code)) {
|
|
89
86
|
// `path` contains just a path separator, exit early to avoid
|
|
90
87
|
// unnecessary work
|
|
91
88
|
return path;
|
|
92
89
|
}
|
|
93
90
|
for (let i = len - 1; i >= offset; --i) {
|
|
94
|
-
if (
|
|
91
|
+
if (isPathSeparator(path.charCodeAt(i))) {
|
|
95
92
|
if (!matchedSlash) {
|
|
96
93
|
end = i;
|
|
97
94
|
break;
|
|
@@ -108,5 +105,5 @@ function dirname(path) {
|
|
|
108
105
|
else
|
|
109
106
|
end = rootEnd;
|
|
110
107
|
}
|
|
111
|
-
return
|
|
108
|
+
return stripTrailingSeparators(path.slice(0, end), isPosixPathSeparator);
|
|
112
109
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
2
|
// This module is browser compatible.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const assert_path_js_1 = require("../_common/assert_path.js");
|
|
8
|
-
const _util_js_1 = require("./_util.js");
|
|
3
|
+
import { CHAR_COLON, CHAR_DOT } from "../_common/constants.js";
|
|
4
|
+
import { assertPath } from "../_common/assert_path.js";
|
|
5
|
+
import { isPathSeparator, isWindowsDeviceRoot } from "./_util.js";
|
|
9
6
|
/**
|
|
10
7
|
* Return the extension of the `path` with leading period.
|
|
11
8
|
*
|
|
@@ -21,8 +18,8 @@ const _util_js_1 = require("./_util.js");
|
|
|
21
18
|
* @param path The path to get the extension from.
|
|
22
19
|
* @returns The extension of the `path`.
|
|
23
20
|
*/
|
|
24
|
-
function extname(path) {
|
|
25
|
-
|
|
21
|
+
export function extname(path) {
|
|
22
|
+
assertPath(path);
|
|
26
23
|
let start = 0;
|
|
27
24
|
let startDot = -1;
|
|
28
25
|
let startPart = 0;
|
|
@@ -35,13 +32,13 @@ function extname(path) {
|
|
|
35
32
|
// path separator as an extra separator at the end of the path that can be
|
|
36
33
|
// disregarded
|
|
37
34
|
if (path.length >= 2 &&
|
|
38
|
-
path.charCodeAt(1) ===
|
|
39
|
-
|
|
35
|
+
path.charCodeAt(1) === CHAR_COLON &&
|
|
36
|
+
isWindowsDeviceRoot(path.charCodeAt(0))) {
|
|
40
37
|
start = startPart = 2;
|
|
41
38
|
}
|
|
42
39
|
for (let i = path.length - 1; i >= start; --i) {
|
|
43
40
|
const code = path.charCodeAt(i);
|
|
44
|
-
if (
|
|
41
|
+
if (isPathSeparator(code)) {
|
|
45
42
|
// If we reached a path separator that was not part of a set of path
|
|
46
43
|
// separators at the end of the string, stop now
|
|
47
44
|
if (!matchedSlash) {
|
|
@@ -56,7 +53,7 @@ function extname(path) {
|
|
|
56
53
|
matchedSlash = false;
|
|
57
54
|
end = i + 1;
|
|
58
55
|
}
|
|
59
|
-
if (code ===
|
|
56
|
+
if (code === CHAR_DOT) {
|
|
60
57
|
// If this is our first dot, mark it as the start of our extension
|
|
61
58
|
if (startDot === -1)
|
|
62
59
|
startDot = i;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
3
2
|
// This module is browser compatible.
|
|
4
|
-
|
|
5
|
-
exports.format = format;
|
|
6
|
-
const format_js_1 = require("../_common/format.js");
|
|
3
|
+
import { _format, assertArg } from "../_common/format.js";
|
|
7
4
|
/**
|
|
8
5
|
* Generate a path from `ParsedPath` object.
|
|
9
6
|
*
|
|
@@ -25,7 +22,7 @@ const format_js_1 = require("../_common/format.js");
|
|
|
25
22
|
* @param pathObject The path object to format.
|
|
26
23
|
* @returns The formatted path.
|
|
27
24
|
*/
|
|
28
|
-
function format(pathObject) {
|
|
29
|
-
|
|
30
|
-
return
|
|
25
|
+
export function format(pathObject) {
|
|
26
|
+
assertArg(pathObject);
|
|
27
|
+
return _format("\\", pathObject);
|
|
31
28
|
}
|