toolcraft 0.0.770 → 0.0.772
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/composition.json +13 -3
- package/dist/composition.json +13 -3
- package/node_modules/@poe-code/safe-fs/dist/contracts/filesystem.d.ts +8 -1
- package/node_modules/@poe-code/safe-fs/dist/core.d.ts +1 -1
- package/node_modules/@poe-code/safe-fs/dist/core.js +1 -1
- package/node_modules/@poe-code/safe-fs/dist/fs/capabilities.js +4 -2
- package/node_modules/@poe-code/safe-fs/dist/fs/devices/index.d.ts +2 -2
- package/node_modules/@poe-code/safe-fs/dist/fs/devices/index.js +9 -6
- package/node_modules/@poe-code/safe-fs/dist/fs/memory/index.d.ts +2 -2
- package/node_modules/@poe-code/safe-fs/dist/fs/memory/index.js +4 -3
- package/node_modules/@poe-code/safe-fs/dist/fs/mount/index.d.ts +2 -2
- package/node_modules/@poe-code/safe-fs/dist/fs/mount/index.js +12 -7
- package/node_modules/@poe-code/safe-fs/dist/fs/overlay/index.d.ts +1 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/overlay/index.js +10 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/overlay/memory-publication.js +18 -0
- package/node_modules/@poe-code/safe-fs/dist/fs/scoped.js +1 -1
- package/node_modules/@poe-code/safe-fs/dist/storage.d.ts +1 -1
- package/node_modules/@poe-code/safe-fs/dist/storage.js +21 -3
- package/node_modules/@poe-code/xml-ast/README.md +10 -1
- package/node_modules/@poe-code/xml-ast/dist/errors.d.ts +4 -0
- package/node_modules/@poe-code/xml-ast/dist/errors.js +7 -0
- package/node_modules/@poe-code/xml-ast/dist/index.d.ts +2 -4
- package/node_modules/@poe-code/xml-ast/dist/index.js +3 -7
- package/node_modules/@poe-code/xml-ast/dist/stream.d.ts +16 -0
- package/node_modules/@poe-code/xml-ast/dist/stream.js +163 -0
- package/node_modules/saxes/README.md +323 -0
- package/node_modules/saxes/package.json +71 -0
- package/node_modules/saxes/saxes.d.ts +635 -0
- package/node_modules/saxes/saxes.js +2053 -0
- package/node_modules/saxes/saxes.js.map +1 -0
- package/node_modules/tiny-http-mcp-server/dist/composition.json +11 -1
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/README.md +6 -2
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/register-client.d.ts +9 -3
- package/node_modules/tiny-http-mcp-server/node_modules/mcp-oauth/dist/client/register-client.js +22 -7
- package/node_modules/tiny-http-mcp-server/package.json +4 -4
- package/node_modules/tiny-mcp-client/README.md +11 -2
- package/node_modules/tiny-mcp-client/dist/index.browser.d.ts +17 -4
- package/node_modules/tiny-mcp-client/dist/index.browser.js +92 -40
- package/node_modules/tiny-mcp-client/dist/index.d.ts +17 -4
- package/node_modules/tiny-mcp-client/dist/index.js +114 -47
- package/node_modules/tiny-stdio-mcp-server/dist/composition.json +1 -1
- package/node_modules/toolcraft-schema/package.json +1 -1
- package/node_modules/xmlchars/LICENSE +18 -0
- package/node_modules/xmlchars/README.md +33 -0
- package/node_modules/xmlchars/package.json +51 -0
- package/node_modules/xmlchars/xml/1.0/ed4.d.ts +31 -0
- package/node_modules/xmlchars/xml/1.0/ed4.js +44 -0
- package/node_modules/xmlchars/xml/1.0/ed4.js.map +1 -0
- package/node_modules/xmlchars/xml/1.0/ed5.d.ts +51 -0
- package/node_modules/xmlchars/xml/1.0/ed5.js +105 -0
- package/node_modules/xmlchars/xml/1.0/ed5.js.map +1 -0
- package/node_modules/xmlchars/xml/1.1/ed2.d.ts +73 -0
- package/node_modules/xmlchars/xml/1.1/ed2.js +145 -0
- package/node_modules/xmlchars/xml/1.1/ed2.js.map +1 -0
- package/node_modules/xmlchars/xmlchars.d.ts +170 -0
- package/node_modules/xmlchars/xmlchars.js +191 -0
- package/node_modules/xmlchars/xmlchars.js.map +1 -0
- package/node_modules/xmlchars/xmlns/1.0/ed3.d.ts +28 -0
- package/node_modules/xmlchars/xmlns/1.0/ed3.js +65 -0
- package/node_modules/xmlchars/xmlns/1.0/ed3.js.map +1 -0
- package/package.json +8 -6
|
@@ -5063,11 +5063,26 @@ function normalizeBearerTokenType(value) {
|
|
|
5063
5063
|
|
|
5064
5064
|
// ../mcp-oauth/dist/client/register-client.js
|
|
5065
5065
|
async function registerOAuthClient(input) {
|
|
5066
|
-
if (
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5066
|
+
if (input.redirectUri !== void 0 && input.redirectUris !== void 0)
|
|
5067
|
+
throw new Error("Specify either redirectUri or redirectUris, not both");
|
|
5068
|
+
const redirects = input.redirectUris === void 0 ? [input.redirectUri] : input.redirectUris;
|
|
5069
|
+
if (!Array.isArray(redirects) || redirects.length === 0 || redirects.length > 32)
|
|
5070
|
+
throw new Error("OAuth registration requires one to 32 redirect URIs");
|
|
5071
|
+
const redirectUris = [];
|
|
5072
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5073
|
+
for (const redirectUri of redirects) {
|
|
5074
|
+
if (typeof redirectUri !== "string" || redirectUri.length === 0)
|
|
5075
|
+
throw new Error("Invalid OAuth registration redirect URI");
|
|
5076
|
+
if (seen.has(redirectUri))
|
|
5077
|
+
throw new Error("Duplicate OAuth registration redirect URI");
|
|
5078
|
+
if (new URL(redirectUri).protocol === "https:")
|
|
5079
|
+
validateHostedOAuthRedirect(redirectUri);
|
|
5080
|
+
else
|
|
5081
|
+
loopbackTarget({ redirectUri });
|
|
5082
|
+
seen.add(redirectUri);
|
|
5083
|
+
redirectUris.push(redirectUri);
|
|
5084
|
+
}
|
|
5085
|
+
const body = JSON.stringify(buildClientRegistrationBody(input.metadata, redirectUris, normalizeOAuthTokenEndpointAuthMethod(input.tokenEndpointAuthMethod) ?? "none"));
|
|
5071
5086
|
if (new TextEncoder().encode(body).byteLength > 65536)
|
|
5072
5087
|
throw new Error("OAuth registration request is too large");
|
|
5073
5088
|
input.signal?.throwIfAborted();
|
|
@@ -5085,9 +5100,9 @@ function getOwnString2(input, key2) {
|
|
|
5085
5100
|
const descriptor = Object.getOwnPropertyDescriptor(input, key2);
|
|
5086
5101
|
return descriptor !== void 0 && "value" in descriptor && typeof descriptor.value === "string" ? descriptor.value : void 0;
|
|
5087
5102
|
}
|
|
5088
|
-
function buildClientRegistrationBody(metadata,
|
|
5103
|
+
function buildClientRegistrationBody(metadata, redirectUris, tokenEndpointAuthMethod) {
|
|
5089
5104
|
const body = {
|
|
5090
|
-
redirect_uris:
|
|
5105
|
+
redirect_uris: redirectUris,
|
|
5091
5106
|
grant_types: ["authorization_code", "refresh_token"],
|
|
5092
5107
|
response_types: ["code"],
|
|
5093
5108
|
token_endpoint_auth_method: tokenEndpointAuthMethod
|
|
@@ -6912,19 +6927,38 @@ function createParameterHeaders(definitions, argumentsValue) {
|
|
|
6912
6927
|
// src/oauth-discovery.ts
|
|
6913
6928
|
var metadataErrorBrand = /* @__PURE__ */ Symbol.for("poe-platform.tiny-mcp-client.OAuthMetadataError");
|
|
6914
6929
|
var OAuthMetadataError = class extends Error {
|
|
6915
|
-
constructor(phase, message, status) {
|
|
6930
|
+
constructor(phase, message, status, reason = status === void 0 ? "invalid-metadata" : "http-error", failures = []) {
|
|
6916
6931
|
super(message);
|
|
6917
6932
|
this.phase = phase;
|
|
6918
6933
|
this.status = status;
|
|
6934
|
+
this.reason = reason;
|
|
6935
|
+
this.failures = failures;
|
|
6919
6936
|
this.name = "OAuthMetadataError";
|
|
6937
|
+
this.category = reason === "invalid-json" ? "json" : reason === "http-error" ? "http" : reason === "network-error" ? "network" : "validation";
|
|
6920
6938
|
Object.defineProperty(this, metadataErrorBrand, { value: true });
|
|
6921
6939
|
}
|
|
6922
6940
|
phase;
|
|
6923
6941
|
status;
|
|
6942
|
+
reason;
|
|
6943
|
+
failures;
|
|
6924
6944
|
static is(value) {
|
|
6925
6945
|
return value instanceof Error && Object.getOwnPropertyDescriptor(value, metadataErrorBrand)?.value === true;
|
|
6926
6946
|
}
|
|
6947
|
+
category;
|
|
6927
6948
|
};
|
|
6949
|
+
function metadataFailure(error, phase, reason) {
|
|
6950
|
+
return OAuthMetadataError.is(error) ? error : new OAuthMetadataError(
|
|
6951
|
+
phase,
|
|
6952
|
+
error instanceof Error ? error.message : String(error),
|
|
6953
|
+
void 0,
|
|
6954
|
+
reason
|
|
6955
|
+
);
|
|
6956
|
+
}
|
|
6957
|
+
function aggregateMetadataFailures(phase, errors, message) {
|
|
6958
|
+
const primary = errors.find((error) => error.category === "validation") ?? errors[0];
|
|
6959
|
+
const failures = errors.map(({ phase: phase2, category, reason, status }) => Object.freeze({ phase: phase2, category, reason, status }));
|
|
6960
|
+
return new OAuthMetadataError(phase, message, primary.status, primary.reason, Object.freeze(failures));
|
|
6961
|
+
}
|
|
6928
6962
|
function defaultOAuthMetadataFetch(input, init) {
|
|
6929
6963
|
return fetch(input, init);
|
|
6930
6964
|
}
|
|
@@ -6990,14 +7024,16 @@ function validateAuthorizationServerMetadata(value, issuer) {
|
|
|
6990
7024
|
if (value.issuer !== issuer) {
|
|
6991
7025
|
throw new OAuthMetadataError(
|
|
6992
7026
|
"authorization-server",
|
|
6993
|
-
`Authorization server metadata issuer mismatch: expected ${issuer}, received ${value.issuer}
|
|
7027
|
+
`Authorization server metadata issuer mismatch: expected ${issuer}, received ${value.issuer}`,
|
|
7028
|
+
void 0,
|
|
7029
|
+
"issuer-mismatch"
|
|
6994
7030
|
);
|
|
6995
7031
|
}
|
|
6996
7032
|
if (typeof value.authorization_endpoint !== "string" || value.authorization_endpoint.length === 0) {
|
|
6997
|
-
throw new
|
|
7033
|
+
throw new OAuthMetadataError("authorization-server", "Authorization server metadata must include authorization_endpoint", void 0, "invalid-endpoint");
|
|
6998
7034
|
}
|
|
6999
7035
|
if (typeof value.token_endpoint !== "string" || value.token_endpoint.length === 0) {
|
|
7000
|
-
throw new
|
|
7036
|
+
throw new OAuthMetadataError("authorization-server", "Authorization server metadata must include token_endpoint", void 0, "invalid-endpoint");
|
|
7001
7037
|
}
|
|
7002
7038
|
for (const field of ["authorization_endpoint", "token_endpoint", "registration_endpoint"]) {
|
|
7003
7039
|
if (field === "registration_endpoint" && value[field] === void 0) {
|
|
@@ -7009,19 +7045,25 @@ function validateAuthorizationServerMetadata(value, issuer) {
|
|
|
7009
7045
|
throw new Error();
|
|
7010
7046
|
}
|
|
7011
7047
|
endpoint = new URL(value[field]);
|
|
7012
|
-
|
|
7013
|
-
|
|
7048
|
+
assertSecureUrl2(endpoint, `Authorization server metadata ${field}`);
|
|
7049
|
+
} catch (error) {
|
|
7050
|
+
throw new OAuthMetadataError("authorization-server", `Authorization server metadata ${field} must be an absolute URL: ${error instanceof Error ? error.message : "invalid URL"}`, void 0, "invalid-endpoint");
|
|
7014
7051
|
}
|
|
7015
|
-
assertSecureUrl2(endpoint, `Authorization server metadata ${field}`);
|
|
7016
7052
|
}
|
|
7017
7053
|
if (!isStringArray(value.response_types_supported) || !value.response_types_supported.includes("code")) {
|
|
7018
|
-
throw new
|
|
7019
|
-
"
|
|
7054
|
+
throw new OAuthMetadataError(
|
|
7055
|
+
"authorization-server",
|
|
7056
|
+
"Authorization server metadata must include response_types_supported containing code",
|
|
7057
|
+
void 0,
|
|
7058
|
+
"response-type-unsupported"
|
|
7020
7059
|
);
|
|
7021
7060
|
}
|
|
7022
7061
|
if (!isStringArray(value.code_challenge_methods_supported) || !value.code_challenge_methods_supported.includes("S256")) {
|
|
7023
|
-
throw new
|
|
7024
|
-
"
|
|
7062
|
+
throw new OAuthMetadataError(
|
|
7063
|
+
"authorization-server",
|
|
7064
|
+
"Authorization server metadata must include code_challenge_methods_supported containing S256",
|
|
7065
|
+
void 0,
|
|
7066
|
+
"pkce-unsupported"
|
|
7025
7067
|
);
|
|
7026
7068
|
}
|
|
7027
7069
|
return value;
|
|
@@ -7037,19 +7079,24 @@ async function readJsonResponse(response, phase, signal) {
|
|
|
7037
7079
|
try {
|
|
7038
7080
|
return JSON.parse(text);
|
|
7039
7081
|
} catch {
|
|
7040
|
-
throw new
|
|
7082
|
+
throw new OAuthMetadataError(phase, `${label} response must be valid JSON`, void 0, "invalid-json");
|
|
7041
7083
|
}
|
|
7042
7084
|
}
|
|
7043
7085
|
async function fetchMetadata(fetch2, location, phase, parentSignal) {
|
|
7044
7086
|
parentSignal?.throwIfAborted();
|
|
7045
7087
|
const deadline = AbortSignal.timeout(1e4);
|
|
7046
7088
|
const signal = parentSignal === void 0 ? deadline : AbortSignal.any([deadline, parentSignal]);
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
|
|
7089
|
+
try {
|
|
7090
|
+
const response = await fetchMcpResponse(fetch2, location, {
|
|
7091
|
+
method: "GET",
|
|
7092
|
+
headers: { Accept: "application/json" },
|
|
7093
|
+
signal
|
|
7094
|
+
});
|
|
7095
|
+
return await readJsonResponse(response, phase, signal);
|
|
7096
|
+
} catch (error) {
|
|
7097
|
+
parentSignal?.throwIfAborted();
|
|
7098
|
+
throw metadataFailure(error, phase, "network-error");
|
|
7099
|
+
}
|
|
7053
7100
|
}
|
|
7054
7101
|
function resolveWellKnownMetadataUrl(inputUrl, suffix) {
|
|
7055
7102
|
const url = new URL(typeof inputUrl === "string" ? inputUrl : inputUrl.toString());
|
|
@@ -7159,7 +7206,7 @@ var OAuthMetadataDiscovery = class {
|
|
|
7159
7206
|
if (resourceMetadataUrl === void 0) {
|
|
7160
7207
|
locations.add(new URL("/.well-known/oauth-protected-resource", resource).toString());
|
|
7161
7208
|
}
|
|
7162
|
-
|
|
7209
|
+
const errors = [];
|
|
7163
7210
|
for (const location of locations) {
|
|
7164
7211
|
try {
|
|
7165
7212
|
const metadata = validateProtectedResourceMetadata(
|
|
@@ -7169,17 +7216,18 @@ var OAuthMetadataDiscovery = class {
|
|
|
7169
7216
|
return { location, metadata };
|
|
7170
7217
|
} catch (error) {
|
|
7171
7218
|
signal?.throwIfAborted();
|
|
7172
|
-
|
|
7219
|
+
errors.push(metadataFailure(error, "protected-resource", "invalid-metadata"));
|
|
7173
7220
|
}
|
|
7174
7221
|
}
|
|
7175
|
-
throw
|
|
7222
|
+
throw aggregateMetadataFailures("protected-resource", errors, errors.at(-1).message);
|
|
7176
7223
|
}
|
|
7177
|
-
async discover(resourceUrl, { resourceMetadataUrl, signal } = {}) {
|
|
7224
|
+
async discover(resourceUrl, { resourceMetadataUrl, signal, expectedIssuer } = {}) {
|
|
7178
7225
|
signal?.throwIfAborted();
|
|
7226
|
+
if (expectedIssuer !== void 0) validateAuthorizationServerIssuer(expectedIssuer);
|
|
7179
7227
|
const cacheKey = canonicalizeResourceIndicator(resourceUrl);
|
|
7180
7228
|
resolveProtectedResourceMetadataUrl(resourceUrl, resourceMetadataUrl);
|
|
7181
7229
|
const memoryCachedResult = this.memoryCache.get(cacheKey);
|
|
7182
|
-
if (memoryCachedResult !== void 0 && resourceMetadataUrl === void 0) {
|
|
7230
|
+
if (memoryCachedResult !== void 0 && resourceMetadataUrl === void 0 && (expectedIssuer === void 0 || memoryCachedResult.authorizationServer === expectedIssuer)) {
|
|
7183
7231
|
return structuredClone(memoryCachedResult);
|
|
7184
7232
|
}
|
|
7185
7233
|
const sharedCachedResult = resourceMetadataUrl === void 0 ? await waitForCache(this.cache?.get(cacheKey), signal) : void 0;
|
|
@@ -7187,44 +7235,63 @@ var OAuthMetadataDiscovery = class {
|
|
|
7187
7235
|
if (sharedCachedResult !== null && sharedCachedResult !== void 0 && resourceMetadataUrl === void 0) {
|
|
7188
7236
|
try {
|
|
7189
7237
|
const result = validateCachedDiscovery(sharedCachedResult, cacheKey);
|
|
7190
|
-
|
|
7191
|
-
|
|
7238
|
+
if (expectedIssuer === void 0 || result.authorizationServer === expectedIssuer) {
|
|
7239
|
+
this.memoryCache.set(cacheKey, structuredClone(result));
|
|
7240
|
+
return result;
|
|
7241
|
+
}
|
|
7192
7242
|
} catch {
|
|
7193
7243
|
await waitForCache(this.cache?.delete?.(cacheKey), signal);
|
|
7194
7244
|
}
|
|
7195
7245
|
}
|
|
7196
7246
|
const { location: resourceMetadataLocation, metadata: resourceMetadata } = await this.discoverProtectedResource(cacheKey, resourceMetadataUrl, signal);
|
|
7197
7247
|
const authorizationServerErrors = [];
|
|
7198
|
-
|
|
7199
|
-
|
|
7248
|
+
const failures = [];
|
|
7249
|
+
if (expectedIssuer !== void 0 && !resourceMetadata.authorization_servers.includes(expectedIssuer)) {
|
|
7250
|
+
throw new OAuthMetadataError("authorization-server", "Expected issuer was not advertised by the protected resource", void 0, "issuer-mismatch");
|
|
7251
|
+
}
|
|
7252
|
+
const authorizationServers = expectedIssuer === void 0 ? resourceMetadata.authorization_servers : [expectedIssuer];
|
|
7253
|
+
for (const authorizationServer of authorizationServers) {
|
|
7254
|
+
let normalizedAuthorizationServer;
|
|
7255
|
+
try {
|
|
7256
|
+
normalizedAuthorizationServer = validateAuthorizationServerIssuer(authorizationServer);
|
|
7257
|
+
} catch (error) {
|
|
7258
|
+
const failure = metadataFailure(error, "authorization-server", "invalid-metadata");
|
|
7259
|
+
failures.push(failure);
|
|
7260
|
+
authorizationServerErrors.push(failure.message);
|
|
7261
|
+
continue;
|
|
7262
|
+
}
|
|
7200
7263
|
const metadataLocations = authorizationServerMetadataLocations(normalizedAuthorizationServer);
|
|
7201
7264
|
for (const authorizationServerMetadataUrl of metadataLocations) {
|
|
7265
|
+
let authorizationServerMetadata;
|
|
7202
7266
|
try {
|
|
7203
|
-
|
|
7267
|
+
authorizationServerMetadata = validateAuthorizationServerMetadata(
|
|
7204
7268
|
await fetchMetadata(this.fetchImpl, authorizationServerMetadataUrl, "authorization-server", signal),
|
|
7205
7269
|
normalizedAuthorizationServer
|
|
7206
7270
|
);
|
|
7207
|
-
const result = {
|
|
7208
|
-
resource: resourceMetadata.resource,
|
|
7209
|
-
resourceMetadataUrl: resourceMetadataLocation,
|
|
7210
|
-
resourceMetadata,
|
|
7211
|
-
authorizationServer: normalizedAuthorizationServer,
|
|
7212
|
-
authorizationServerMetadataUrl,
|
|
7213
|
-
authorizationServerMetadata
|
|
7214
|
-
};
|
|
7215
|
-
this.memoryCache.set(cacheKey, structuredClone(result));
|
|
7216
|
-
await waitForCache(this.cache?.set(cacheKey, structuredClone(result)), signal);
|
|
7217
|
-
return result;
|
|
7218
7271
|
} catch (error) {
|
|
7219
7272
|
signal?.throwIfAborted();
|
|
7273
|
+
failures.push(metadataFailure(error, "authorization-server", "invalid-metadata"));
|
|
7220
7274
|
authorizationServerErrors.push(
|
|
7221
7275
|
`${authorizationServerMetadataUrl}: ${error instanceof Error ? error.message : String(error)}`
|
|
7222
7276
|
);
|
|
7277
|
+
continue;
|
|
7223
7278
|
}
|
|
7279
|
+
const result = {
|
|
7280
|
+
resource: resourceMetadata.resource,
|
|
7281
|
+
resourceMetadataUrl: resourceMetadataLocation,
|
|
7282
|
+
resourceMetadata,
|
|
7283
|
+
authorizationServer: normalizedAuthorizationServer,
|
|
7284
|
+
authorizationServerMetadataUrl,
|
|
7285
|
+
authorizationServerMetadata
|
|
7286
|
+
};
|
|
7287
|
+
await waitForCache(this.cache?.set(cacheKey, structuredClone(result)), signal);
|
|
7288
|
+
this.memoryCache.set(cacheKey, structuredClone(result));
|
|
7289
|
+
return result;
|
|
7224
7290
|
}
|
|
7225
7291
|
}
|
|
7226
|
-
throw
|
|
7292
|
+
throw aggregateMetadataFailures(
|
|
7227
7293
|
"authorization-server",
|
|
7294
|
+
failures,
|
|
7228
7295
|
`Unable to load authorization server metadata for ${cacheKey}: ${authorizationServerErrors.join(
|
|
7229
7296
|
"; "
|
|
7230
7297
|
)}`
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Copyright Louis-Dominique Dubeau and contributors to xmlchars
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
5
|
+
the Software without restriction, including without limitation the rights to
|
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
7
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
8
|
+
subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
15
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
16
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
17
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
18
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Utilities for determining whether characters belong to character classes defined
|
|
2
|
+
by the XML specs.
|
|
3
|
+
|
|
4
|
+
## Organization
|
|
5
|
+
|
|
6
|
+
It used to be that the library was contained in a single file and you could just
|
|
7
|
+
import/require/what-have-you the `xmlchars` module. However, that setup did not
|
|
8
|
+
work well for people who cared about code optimization. Importing `xmlchars`
|
|
9
|
+
meant importing *all* of the library and because of the way the code was
|
|
10
|
+
generated there was no way to shake the resulting code tree.
|
|
11
|
+
|
|
12
|
+
Different modules cover different standards. At the time this documentation was
|
|
13
|
+
last updated, we had:
|
|
14
|
+
|
|
15
|
+
* `xmlchars/xml/1.0/ed5` which covers XML 1.0 edition 5.
|
|
16
|
+
* `xmlchars/xml/1.0/ed4` which covers XML 1.0 edition 4.
|
|
17
|
+
* `xmlchars/xml/1.1/ed2` which covers XML 1.0 edition 2.
|
|
18
|
+
* `xmlchars/xmlns/1.0/ed3` which covers XML Namespaces 1.0 edition 3.
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
The "things" each module contains can be categorized as follows:
|
|
23
|
+
|
|
24
|
+
1. "Fragments": these are parts and pieces of regular expressions that
|
|
25
|
+
correspond to the productions defined in the standard that the module
|
|
26
|
+
covers. You'd use these to *build regular expressions*.
|
|
27
|
+
|
|
28
|
+
2. Regular expressions that correspond to the productions defined in the
|
|
29
|
+
standard that the module covers.
|
|
30
|
+
|
|
31
|
+
3. Lists: these are arrays of characters that correspond to the productions.
|
|
32
|
+
|
|
33
|
+
4. Functions that test code points to verify whether they fit a production.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "xmlchars",
|
|
3
|
+
"version": "2.2.0",
|
|
4
|
+
"description": "Utilities for determining if characters belong to character classes defined by the XML specs.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"XML",
|
|
7
|
+
"validation"
|
|
8
|
+
],
|
|
9
|
+
"main": "xmlchars.js",
|
|
10
|
+
"types": "xmlchars.d.ts",
|
|
11
|
+
"repository": "https://github.com/lddubeau/xmlchars.git",
|
|
12
|
+
"author": "Louis-Dominique Dubeau <ldd@lddubeau.com>",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@commitlint/cli": "^8.1.0",
|
|
16
|
+
"@commitlint/config-angular": "^8.1.0",
|
|
17
|
+
"@types/chai": "^4.2.1",
|
|
18
|
+
"@types/mocha": "^5.2.7",
|
|
19
|
+
"chai": "^4.2.0",
|
|
20
|
+
"conventional-changelog-cli": "^2.0.23",
|
|
21
|
+
"husky": "^3.0.5",
|
|
22
|
+
"mocha": "^6.2.0",
|
|
23
|
+
"ts-node": "^8.3.0",
|
|
24
|
+
"tslint": "^5.19.0",
|
|
25
|
+
"tslint-config-lddubeau": "^4.1.0",
|
|
26
|
+
"typescript": "^3.6.2"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"copy": "cp README.md LICENSE build/dist && sed -e'/\"private\": true/d' package.json > build/dist/package.json",
|
|
30
|
+
"build": "tsc && npm run copy",
|
|
31
|
+
"pretest": "npm run build",
|
|
32
|
+
"test": "mocha",
|
|
33
|
+
"posttest": "tslint -p tsconfig.json && tslint -p test/tsconfig.json",
|
|
34
|
+
"prepack": "node -e 'require(\"assert\")(!require(\"./package.json\").private)'",
|
|
35
|
+
"test-install": "npm run test && (test_dir=build/install_dir; rm -rf $test_dir; mkdir -p $test_dir/node_modules; packname=`npm run xmlchars:pack --silent`; (cd $test_dir; npm install ../$packname); rm -rf $test_dir)",
|
|
36
|
+
"xmlchars:pack": "cd build/dist/ && (packname=`npm pack --silent`; mv $packname ..; echo $packname)",
|
|
37
|
+
"prepublishOnly": "node -e 'require(\"assert\")(!require(\"./package.json\").private)'",
|
|
38
|
+
"xmlchars:publish": "npm run test-install && (cd build/dist && npm publish)",
|
|
39
|
+
"preversion": "npm run test-install",
|
|
40
|
+
"version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md",
|
|
41
|
+
"postversion": "npm run xmlchars:publish",
|
|
42
|
+
"postpublish": "git push origin --follow-tags",
|
|
43
|
+
"clean": "rm -rf build"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {},
|
|
46
|
+
"husky": {
|
|
47
|
+
"hooks": {
|
|
48
|
+
"commit-msg": "commitlint -e $HUSKY_GIT_PARAMS"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Character classes and associated utilities for the 4th edition of XML 1.0.
|
|
3
|
+
*
|
|
4
|
+
* These are deprecated in the 5th edition but some of the standards related to
|
|
5
|
+
* XML 1.0 (e.g. XML Schema 1.0) refer to these. So they are still generally
|
|
6
|
+
* useful.
|
|
7
|
+
*
|
|
8
|
+
* @author Louis-Dominique Dubeau
|
|
9
|
+
* @license MIT
|
|
10
|
+
* @copyright Louis-Dominique Dubeau
|
|
11
|
+
*/
|
|
12
|
+
export declare const CHAR = "\t\n\r -\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF";
|
|
13
|
+
export declare const S = " \t\r\n";
|
|
14
|
+
export declare const BASE_CHAR = "A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\u0131\u0134-\u013E\u0141-\u0148\u014A-\u017E\u0180-\u01C3\u01CD-\u01F0\u01F4-\u01F5\u01FA-\u0217\u0250-\u02A8\u02BB-\u02C1\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03CE\u03D0-\u03D6\u03DA\u03DC\u03DE\u03E0\u03E2-\u03F3\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E-\u0481\u0490-\u04C4\u04C7-\u04C8\u04CB-\u04CC\u04D0-\u04EB\u04EE-\u04F5\u04F8-\u04F9\u0531-\u0556\u0559\u0561-\u0586\u05D0-\u05EA\u05F0-\u05F2\u0621-\u063A\u0641-\u064A\u0671-\u06B7\u06BA-\u06BE\u06C0-\u06CE\u06D0-\u06D3\u06D5\u06E5-\u06E6\u0905-\u0939\u093D\u0958-\u0961\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8B\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AE0\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B36-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB5\u0BB7-\u0BB9\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CDE\u0CE0-\u0CE1\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D60-\u0D61\u0E01-\u0E2E\u0E30\u0E32-\u0E33\u0E40-\u0E45\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EAE\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0F40-\u0F47\u0F49-\u0F69\u10A0-\u10C5\u10D0-\u10F6\u1100\u1102-\u1103\u1105-\u1107\u1109\u110B-\u110C\u110E-\u1112\u113C\u113E\u1140\u114C\u114E\u1150\u1154-\u1155\u1159\u115F-\u1161\u1163\u1165\u1167\u1169\u116D-\u116E\u1172-\u1173\u1175\u119E\u11A8\u11AB\u11AE-\u11AF\u11B7-\u11B8\u11BA\u11BC-\u11C2\u11EB\u11F0\u11F9\u1E00-\u1E9B\u1EA0-\u1EF9\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2126\u212A-\u212B\u212E\u2180-\u2182\u3041-\u3094\u30A1-\u30FA\u3105-\u312C\uAC00-\uD7A3";
|
|
15
|
+
export declare const IDEOGRAPHIC = "\u4E00-\u9FA5\u3007\u3021-\u3029";
|
|
16
|
+
export declare const COMBINING_CHAR = "\u0300-\u0345\u0360-\u0361\u0483-\u0486\u0591-\u05A1\u05A3-\u05B9\u05BB-\u05BD\u05BF\u05C1-\u05C2\u05C4\u064B-\u0652\u0670\u06D6-\u06DC\u06DD-\u06DF\u06E0-\u06E4\u06E7-\u06E8\u06EA-\u06ED\u0901-\u0903\u093C\u093E-\u094C\u094D\u0951-\u0954\u0962-\u0963\u0981-\u0983\u09BC\u09BE\u09BF\u09C0-\u09C4\u09C7-\u09C8\u09CB-\u09CD\u09D7\u09E2-\u09E3\u0A02\u0A3C\u0A3E\u0A3F\u0A40-\u0A42\u0A47-\u0A48\u0A4B-\u0A4D\u0A70-\u0A71\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0B01-\u0B03\u0B3C\u0B3E-\u0B43\u0B47-\u0B48\u0B4B-\u0B4D\u0B56-\u0B57\u0B82-\u0B83\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C01-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55-\u0C56\u0C82-\u0C83\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5-\u0CD6\u0D02-\u0D03\u0D3E-\u0D43\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\u0F18-\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86-\u0F8B\u0F90-\u0F95\u0F97\u0F99-\u0FAD\u0FB1-\u0FB7\u0FB9\u20D0-\u20DC\u20E1\u302A-\u302F\u3099\u309A";
|
|
17
|
+
export declare const DIGIT = "0-9\u0660-\u0669\u06F0-\u06F9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE7-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29";
|
|
18
|
+
export declare const EXTENDER = "\u00B7\u02D0\u02D1\u0387\u0640\u0E46\u0EC6\u3005\u3031-\u3035\u309D-\u309E\u30FC-\u30FE";
|
|
19
|
+
export declare const LETTER: string;
|
|
20
|
+
export declare const NAME_CHAR: string;
|
|
21
|
+
export declare const CHAR_RE: RegExp;
|
|
22
|
+
export declare const S_RE: RegExp;
|
|
23
|
+
export declare const BASE_CHAR_RE: RegExp;
|
|
24
|
+
export declare const IDEOGRAPHIC_RE: RegExp;
|
|
25
|
+
export declare const COMBINING_CHAR_RE: RegExp;
|
|
26
|
+
export declare const DIGIT_RE: RegExp;
|
|
27
|
+
export declare const EXTENDER_RE: RegExp;
|
|
28
|
+
export declare const LETTER_RE: RegExp;
|
|
29
|
+
export declare const NAME_CHAR_RE: RegExp;
|
|
30
|
+
export declare const NAME_RE: RegExp;
|
|
31
|
+
export declare const NMTOKEN_RE: RegExp;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Character classes and associated utilities for the 4th edition of XML 1.0.
|
|
4
|
+
*
|
|
5
|
+
* These are deprecated in the 5th edition but some of the standards related to
|
|
6
|
+
* XML 1.0 (e.g. XML Schema 1.0) refer to these. So they are still generally
|
|
7
|
+
* useful.
|
|
8
|
+
*
|
|
9
|
+
* @author Louis-Dominique Dubeau
|
|
10
|
+
* @license MIT
|
|
11
|
+
* @copyright Louis-Dominique Dubeau
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
//
|
|
15
|
+
// Fragments.
|
|
16
|
+
//
|
|
17
|
+
exports.CHAR = "\t\n\r -\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF";
|
|
18
|
+
exports.S = " \t\r\n";
|
|
19
|
+
// tslint:disable-next-line:missing-jsdoc max-line-length
|
|
20
|
+
exports.BASE_CHAR = "A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u0100-\u0131\u0134-\u013E\u0141-\u0148\u014A-\u017E\u0180-\u01C3\u01CD-\u01F0\u01F4-\u01F5\u01FA-\u0217\u0250-\u02A8\u02BB-\u02C1\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03CE\u03D0-\u03D6\u03DA\u03DC\u03DE\u03E0\u03E2-\u03F3\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E-\u0481\u0490-\u04C4\u04C7-\u04C8\u04CB-\u04CC\u04D0-\u04EB\u04EE-\u04F5\u04F8-\u04F9\u0531-\u0556\u0559\u0561-\u0586\u05D0-\u05EA\u05F0-\u05F2\u0621-\u063A\u0641-\u064A\u0671-\u06B7\u06BA-\u06BE\u06C0-\u06CE\u06D0-\u06D3\u06D5\u06E5-\u06E6\u0905-\u0939\u093D\u0958-\u0961\u0985-\u098C\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09DC-\u09DD\u09DF-\u09E1\u09F0-\u09F1\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33\u0A35-\u0A36\u0A38-\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8B\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0AE0\u0B05-\u0B0C\u0B0F-\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B36-\u0B39\u0B3D\u0B5C-\u0B5D\u0B5F-\u0B61\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB5\u0BB7-\u0BB9\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C60-\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CDE\u0CE0-\u0CE1\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D28\u0D2A-\u0D39\u0D60-\u0D61\u0E01-\u0E2E\u0E30\u0E32-\u0E33\u0E40-\u0E45\u0E81-\u0E82\u0E84\u0E87-\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA-\u0EAB\u0EAD-\u0EAE\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0F40-\u0F47\u0F49-\u0F69\u10A0-\u10C5\u10D0-\u10F6\u1100\u1102-\u1103\u1105-\u1107\u1109\u110B-\u110C\u110E-\u1112\u113C\u113E\u1140\u114C\u114E\u1150\u1154-\u1155\u1159\u115F-\u1161\u1163\u1165\u1167\u1169\u116D-\u116E\u1172-\u1173\u1175\u119E\u11A8\u11AB\u11AE-\u11AF\u11B7-\u11B8\u11BA\u11BC-\u11C2\u11EB\u11F0\u11F9\u1E00-\u1E9B\u1EA0-\u1EF9\u1F00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2126\u212A-\u212B\u212E\u2180-\u2182\u3041-\u3094\u30A1-\u30FA\u3105-\u312C\uAC00-\uD7A3";
|
|
21
|
+
exports.IDEOGRAPHIC = "\u4E00-\u9FA5\u3007\u3021-\u3029";
|
|
22
|
+
// tslint:disable-next-line:missing-jsdoc max-line-length
|
|
23
|
+
exports.COMBINING_CHAR = "\u0300-\u0345\u0360-\u0361\u0483-\u0486\u0591-\u05A1\u05A3-\u05B9\u05BB-\u05BD\u05BF\u05C1-\u05C2\u05C4\u064B-\u0652\u0670\u06D6-\u06DC\u06DD-\u06DF\u06E0-\u06E4\u06E7-\u06E8\u06EA-\u06ED\u0901-\u0903\u093C\u093E-\u094C\u094D\u0951-\u0954\u0962-\u0963\u0981-\u0983\u09BC\u09BE\u09BF\u09C0-\u09C4\u09C7-\u09C8\u09CB-\u09CD\u09D7\u09E2-\u09E3\u0A02\u0A3C\u0A3E\u0A3F\u0A40-\u0A42\u0A47-\u0A48\u0A4B-\u0A4D\u0A70-\u0A71\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0B01-\u0B03\u0B3C\u0B3E-\u0B43\u0B47-\u0B48\u0B4B-\u0B4D\u0B56-\u0B57\u0B82-\u0B83\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C01-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55-\u0C56\u0C82-\u0C83\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5-\u0CD6\u0D02-\u0D03\u0D3E-\u0D43\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB-\u0EBC\u0EC8-\u0ECD\u0F18-\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86-\u0F8B\u0F90-\u0F95\u0F97\u0F99-\u0FAD\u0FB1-\u0FB7\u0FB9\u20D0-\u20DC\u20E1\u302A-\u302F\u3099\u309A";
|
|
24
|
+
// tslint:disable-next-line:missing-jsdoc max-line-length
|
|
25
|
+
exports.DIGIT = "0-9\u0660-\u0669\u06F0-\u06F9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE7-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29";
|
|
26
|
+
// tslint:disable-next-line:missing-jsdoc max-line-length
|
|
27
|
+
exports.EXTENDER = "\u00B7\u02D0\u02D1\u0387\u0640\u0E46\u0EC6\u3005\u3031-\u3035\u309D-\u309E\u30FC-\u30FE";
|
|
28
|
+
exports.LETTER = exports.BASE_CHAR + exports.IDEOGRAPHIC;
|
|
29
|
+
exports.NAME_CHAR = "-" + exports.LETTER + exports.DIGIT + "._:" + exports.COMBINING_CHAR + exports.EXTENDER;
|
|
30
|
+
//
|
|
31
|
+
// Regular expressions.
|
|
32
|
+
//
|
|
33
|
+
exports.CHAR_RE = new RegExp("^[" + exports.CHAR + "]$", "u");
|
|
34
|
+
exports.S_RE = new RegExp("^[" + exports.S + "]+$", "u");
|
|
35
|
+
exports.BASE_CHAR_RE = new RegExp("^[" + exports.BASE_CHAR + "]$", "u");
|
|
36
|
+
exports.IDEOGRAPHIC_RE = new RegExp("^[" + exports.IDEOGRAPHIC + "]$", "u");
|
|
37
|
+
exports.COMBINING_CHAR_RE = new RegExp("^[" + exports.COMBINING_CHAR + "]$", "u");
|
|
38
|
+
exports.DIGIT_RE = new RegExp("^[" + exports.DIGIT + "]$", "u");
|
|
39
|
+
exports.EXTENDER_RE = new RegExp("^[" + exports.EXTENDER + "]$", "u");
|
|
40
|
+
exports.LETTER_RE = new RegExp("^[" + exports.LETTER + "]$", "u");
|
|
41
|
+
exports.NAME_CHAR_RE = new RegExp("^[" + exports.NAME_CHAR + "]$", "u");
|
|
42
|
+
exports.NAME_RE = new RegExp("^[" + exports.LETTER + "_:][" + exports.NAME_CHAR + "]*$", "u");
|
|
43
|
+
exports.NMTOKEN_RE = new RegExp("^[" + exports.NAME_CHAR + "]+$", "u");
|
|
44
|
+
//# sourceMappingURL=ed4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ed4.js","sourceRoot":"","sources":["../../../../src/xml/1.0/ed4.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAEH,EAAE;AACF,aAAa;AACb,EAAE;AAEW,QAAA,IAAI,GAAG,sDAAsD,CAAC;AAE9D,QAAA,CAAC,GAAG,SAAS,CAAC;AAE3B,yDAAyD;AAC5C,QAAA,SAAS,GAAG,osEAAosE,CAAC;AAEjtE,QAAA,WAAW,GAAG,kCAAkC,CAAC;AAE9D,yDAAyD;AAC5C,QAAA,cAAc,GAAG,0gCAA0gC,CAAC;AAEziC,yDAAyD;AAC5C,QAAA,KAAK,GAAG,2LAA2L,CAAC;AAEjN,yDAAyD;AAC5C,QAAA,QAAQ,GAAG,yFAAyF,CAAC;AAErG,QAAA,MAAM,GAAI,iBAAS,GAAG,mBAAW,CAAC;AAElC,QAAA,SAAS,GAAG,MAAI,cAAM,GAAG,aAAK,WAAM,sBAAc,GAAG,gBAAU,CAAC;AAE7E,EAAE;AACF,uBAAuB;AACvB,EAAE;AAEW,QAAA,OAAO,GAAG,IAAI,MAAM,CAAC,OAAK,YAAI,OAAI,EAAE,GAAG,CAAC,CAAC;AAEzC,QAAA,IAAI,GAAG,IAAI,MAAM,CAAC,OAAK,SAAC,QAAK,EAAE,GAAG,CAAC,CAAC;AAEpC,QAAA,YAAY,GAAG,IAAI,MAAM,CAAC,OAAK,iBAAS,OAAI,EAAE,GAAG,CAAC,CAAC;AAEnD,QAAA,cAAc,GAAG,IAAI,MAAM,CAAC,OAAK,mBAAW,OAAI,EAAE,GAAG,CAAC,CAAC;AAEvD,QAAA,iBAAiB,GAAG,IAAI,MAAM,CAAC,OAAK,sBAAc,OAAI,EAAE,GAAG,CAAC,CAAC;AAE7D,QAAA,QAAQ,GAAG,IAAI,MAAM,CAAC,OAAK,aAAK,OAAI,EAAE,GAAG,CAAC,CAAC;AAE3C,QAAA,WAAW,GAAG,IAAI,MAAM,CAAC,OAAK,gBAAQ,OAAI,EAAE,GAAG,CAAC,CAAC;AAEjD,QAAA,SAAS,GAAG,IAAI,MAAM,CAAC,OAAK,cAAM,OAAI,EAAE,GAAG,CAAC,CAAC;AAE7C,QAAA,YAAY,GAAG,IAAI,MAAM,CAAC,OAAK,iBAAS,OAAI,EAAE,GAAG,CAAC,CAAC;AAEnD,QAAA,OAAO,GAAG,IAAI,MAAM,CAAC,OAAK,cAAM,YAAO,iBAAS,QAAK,EAAE,GAAG,CAAC,CAAC;AAE5D,QAAA,UAAU,GAAG,IAAI,MAAM,CAAC,OAAK,iBAAS,QAAK,EAAE,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Character classes and associated utilities for the 5th edition of XML 1.0.
|
|
3
|
+
*
|
|
4
|
+
* @author Louis-Dominique Dubeau
|
|
5
|
+
* @license MIT
|
|
6
|
+
* @copyright Louis-Dominique Dubeau
|
|
7
|
+
*/
|
|
8
|
+
export declare const CHAR = "\t\n\r -\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF";
|
|
9
|
+
export declare const S = " \t\r\n";
|
|
10
|
+
export declare const NAME_START_CHAR = ":A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\uD800\uDC00-\uDB7F\uDFFF";
|
|
11
|
+
export declare const NAME_CHAR: string;
|
|
12
|
+
export declare const CHAR_RE: RegExp;
|
|
13
|
+
export declare const S_RE: RegExp;
|
|
14
|
+
export declare const NAME_START_CHAR_RE: RegExp;
|
|
15
|
+
export declare const NAME_CHAR_RE: RegExp;
|
|
16
|
+
export declare const NAME_RE: RegExp;
|
|
17
|
+
export declare const NMTOKEN_RE: RegExp;
|
|
18
|
+
/** All characters in the ``S`` production. */
|
|
19
|
+
export declare const S_LIST: number[];
|
|
20
|
+
/**
|
|
21
|
+
* Determines whether a codepoint matches the ``CHAR`` production.
|
|
22
|
+
*
|
|
23
|
+
* @param c The code point.
|
|
24
|
+
*
|
|
25
|
+
* @returns ``true`` if the codepoint matches ``CHAR``.
|
|
26
|
+
*/
|
|
27
|
+
export declare function isChar(c: number): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Determines whether a codepoint matches the ``S`` (space) production.
|
|
30
|
+
*
|
|
31
|
+
* @param c The code point.
|
|
32
|
+
*
|
|
33
|
+
* @returns ``true`` if the codepoint matches ``S``.
|
|
34
|
+
*/
|
|
35
|
+
export declare function isS(c: number): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Determines whether a codepoint matches the ``NAME_START_CHAR`` production.
|
|
38
|
+
*
|
|
39
|
+
* @param c The code point.
|
|
40
|
+
*
|
|
41
|
+
* @returns ``true`` if the codepoint matches ``NAME_START_CHAR``.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isNameStartChar(c: number): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Determines whether a codepoint matches the ``NAME_CHAR`` production.
|
|
46
|
+
*
|
|
47
|
+
* @param c The code point.
|
|
48
|
+
*
|
|
49
|
+
* @returns ``true`` if the codepoint matches ``NAME_CHAR``.
|
|
50
|
+
*/
|
|
51
|
+
export declare function isNameChar(c: number): boolean;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Character classes and associated utilities for the 5th edition of XML 1.0.
|
|
4
|
+
*
|
|
5
|
+
* @author Louis-Dominique Dubeau
|
|
6
|
+
* @license MIT
|
|
7
|
+
* @copyright Louis-Dominique Dubeau
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
//
|
|
11
|
+
// Fragments.
|
|
12
|
+
//
|
|
13
|
+
exports.CHAR = "\t\n\r -\uD7FF\uE000-\uFFFD\uD800\uDC00-\uDBFF\uDFFF";
|
|
14
|
+
exports.S = " \t\r\n";
|
|
15
|
+
// tslint:disable-next-line:max-line-length
|
|
16
|
+
exports.NAME_START_CHAR = ":A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\uD800\uDC00-\uDB7F\uDFFF";
|
|
17
|
+
exports.NAME_CHAR = "-" + exports.NAME_START_CHAR + ".0-9\u00B7\u0300-\u036F\u203F-\u2040";
|
|
18
|
+
//
|
|
19
|
+
// Regular expressions.
|
|
20
|
+
//
|
|
21
|
+
exports.CHAR_RE = new RegExp("^[" + exports.CHAR + "]$", "u");
|
|
22
|
+
exports.S_RE = new RegExp("^[" + exports.S + "]+$", "u");
|
|
23
|
+
exports.NAME_START_CHAR_RE = new RegExp("^[" + exports.NAME_START_CHAR + "]$", "u");
|
|
24
|
+
exports.NAME_CHAR_RE = new RegExp("^[" + exports.NAME_CHAR + "]$", "u");
|
|
25
|
+
exports.NAME_RE = new RegExp("^[" + exports.NAME_START_CHAR + "][" + exports.NAME_CHAR + "]*$", "u");
|
|
26
|
+
exports.NMTOKEN_RE = new RegExp("^[" + exports.NAME_CHAR + "]+$", "u");
|
|
27
|
+
var TAB = 9;
|
|
28
|
+
var NL = 0xA;
|
|
29
|
+
var CR = 0xD;
|
|
30
|
+
var SPACE = 0x20;
|
|
31
|
+
//
|
|
32
|
+
// Lists.
|
|
33
|
+
//
|
|
34
|
+
/** All characters in the ``S`` production. */
|
|
35
|
+
exports.S_LIST = [SPACE, NL, CR, TAB];
|
|
36
|
+
/**
|
|
37
|
+
* Determines whether a codepoint matches the ``CHAR`` production.
|
|
38
|
+
*
|
|
39
|
+
* @param c The code point.
|
|
40
|
+
*
|
|
41
|
+
* @returns ``true`` if the codepoint matches ``CHAR``.
|
|
42
|
+
*/
|
|
43
|
+
function isChar(c) {
|
|
44
|
+
return (c >= SPACE && c <= 0xD7FF) ||
|
|
45
|
+
c === NL || c === CR || c === TAB ||
|
|
46
|
+
(c >= 0xE000 && c <= 0xFFFD) ||
|
|
47
|
+
(c >= 0x10000 && c <= 0x10FFFF);
|
|
48
|
+
}
|
|
49
|
+
exports.isChar = isChar;
|
|
50
|
+
/**
|
|
51
|
+
* Determines whether a codepoint matches the ``S`` (space) production.
|
|
52
|
+
*
|
|
53
|
+
* @param c The code point.
|
|
54
|
+
*
|
|
55
|
+
* @returns ``true`` if the codepoint matches ``S``.
|
|
56
|
+
*/
|
|
57
|
+
function isS(c) {
|
|
58
|
+
return c === SPACE || c === NL || c === CR || c === TAB;
|
|
59
|
+
}
|
|
60
|
+
exports.isS = isS;
|
|
61
|
+
/**
|
|
62
|
+
* Determines whether a codepoint matches the ``NAME_START_CHAR`` production.
|
|
63
|
+
*
|
|
64
|
+
* @param c The code point.
|
|
65
|
+
*
|
|
66
|
+
* @returns ``true`` if the codepoint matches ``NAME_START_CHAR``.
|
|
67
|
+
*/
|
|
68
|
+
function isNameStartChar(c) {
|
|
69
|
+
return ((c >= 0x41 && c <= 0x5A) ||
|
|
70
|
+
(c >= 0x61 && c <= 0x7A) ||
|
|
71
|
+
c === 0x3A ||
|
|
72
|
+
c === 0x5F ||
|
|
73
|
+
c === 0x200C ||
|
|
74
|
+
c === 0x200D ||
|
|
75
|
+
(c >= 0xC0 && c <= 0xD6) ||
|
|
76
|
+
(c >= 0xD8 && c <= 0xF6) ||
|
|
77
|
+
(c >= 0x00F8 && c <= 0x02FF) ||
|
|
78
|
+
(c >= 0x0370 && c <= 0x037D) ||
|
|
79
|
+
(c >= 0x037F && c <= 0x1FFF) ||
|
|
80
|
+
(c >= 0x2070 && c <= 0x218F) ||
|
|
81
|
+
(c >= 0x2C00 && c <= 0x2FEF) ||
|
|
82
|
+
(c >= 0x3001 && c <= 0xD7FF) ||
|
|
83
|
+
(c >= 0xF900 && c <= 0xFDCF) ||
|
|
84
|
+
(c >= 0xFDF0 && c <= 0xFFFD) ||
|
|
85
|
+
(c >= 0x10000 && c <= 0xEFFFF));
|
|
86
|
+
}
|
|
87
|
+
exports.isNameStartChar = isNameStartChar;
|
|
88
|
+
/**
|
|
89
|
+
* Determines whether a codepoint matches the ``NAME_CHAR`` production.
|
|
90
|
+
*
|
|
91
|
+
* @param c The code point.
|
|
92
|
+
*
|
|
93
|
+
* @returns ``true`` if the codepoint matches ``NAME_CHAR``.
|
|
94
|
+
*/
|
|
95
|
+
function isNameChar(c) {
|
|
96
|
+
return isNameStartChar(c) ||
|
|
97
|
+
(c >= 0x30 && c <= 0x39) ||
|
|
98
|
+
c === 0x2D ||
|
|
99
|
+
c === 0x2E ||
|
|
100
|
+
c === 0xB7 ||
|
|
101
|
+
(c >= 0x0300 && c <= 0x036F) ||
|
|
102
|
+
(c >= 0x203F && c <= 0x2040);
|
|
103
|
+
}
|
|
104
|
+
exports.isNameChar = isNameChar;
|
|
105
|
+
//# sourceMappingURL=ed5.js.map
|