fix: keep only source-map extracted node_modules, exclude pnpm artifacts

Restore node_modules to exact state from cli.js.map extraction:
- Move .ignored/ and .ignored_* files back to original package paths
- Remove pnpm symlinks (replaced by real source-map directories)
- Update .gitignore: only exclude /dist/, .pnpm/, .bin/, .ignored* dirs
- All package dist/ folders are now preserved as part of source-map files

After clone, run `pnpm install` to get pnpm-managed symlinks for building.
The committed node_modules contains the original TypeScript/JS source files
as bundled in cli.js.
This commit is contained in:
janlaywss
2026-03-31 21:09:32 +08:00
parent 0d5abe8837
commit a192e187e8
2211 changed files with 329136 additions and 84 deletions

View File

@@ -0,0 +1,104 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.OTLPMetricExporterBase = exports.LowMemoryTemporalitySelector = exports.DeltaTemporalitySelector = exports.CumulativeTemporalitySelector = void 0;
const core_1 = require("@opentelemetry/core");
const sdk_metrics_1 = require("@opentelemetry/sdk-metrics");
const OTLPMetricExporterOptions_1 = require("./OTLPMetricExporterOptions");
const otlp_exporter_base_1 = require("@opentelemetry/otlp-exporter-base");
const api_1 = require("@opentelemetry/api");
const CumulativeTemporalitySelector = () => sdk_metrics_1.AggregationTemporality.CUMULATIVE;
exports.CumulativeTemporalitySelector = CumulativeTemporalitySelector;
const DeltaTemporalitySelector = (instrumentType) => {
switch (instrumentType) {
case sdk_metrics_1.InstrumentType.COUNTER:
case sdk_metrics_1.InstrumentType.OBSERVABLE_COUNTER:
case sdk_metrics_1.InstrumentType.GAUGE:
case sdk_metrics_1.InstrumentType.HISTOGRAM:
case sdk_metrics_1.InstrumentType.OBSERVABLE_GAUGE:
return sdk_metrics_1.AggregationTemporality.DELTA;
case sdk_metrics_1.InstrumentType.UP_DOWN_COUNTER:
case sdk_metrics_1.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:
return sdk_metrics_1.AggregationTemporality.CUMULATIVE;
}
};
exports.DeltaTemporalitySelector = DeltaTemporalitySelector;
const LowMemoryTemporalitySelector = (instrumentType) => {
switch (instrumentType) {
case sdk_metrics_1.InstrumentType.COUNTER:
case sdk_metrics_1.InstrumentType.HISTOGRAM:
return sdk_metrics_1.AggregationTemporality.DELTA;
case sdk_metrics_1.InstrumentType.GAUGE:
case sdk_metrics_1.InstrumentType.UP_DOWN_COUNTER:
case sdk_metrics_1.InstrumentType.OBSERVABLE_UP_DOWN_COUNTER:
case sdk_metrics_1.InstrumentType.OBSERVABLE_COUNTER:
case sdk_metrics_1.InstrumentType.OBSERVABLE_GAUGE:
return sdk_metrics_1.AggregationTemporality.CUMULATIVE;
}
};
exports.LowMemoryTemporalitySelector = LowMemoryTemporalitySelector;
function chooseTemporalitySelectorFromEnvironment() {
const configuredTemporality = ((0, core_1.getStringFromEnv)('OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE') ??
'cumulative').toLowerCase();
if (configuredTemporality === 'cumulative') {
return exports.CumulativeTemporalitySelector;
}
if (configuredTemporality === 'delta') {
return exports.DeltaTemporalitySelector;
}
if (configuredTemporality === 'lowmemory') {
return exports.LowMemoryTemporalitySelector;
}
api_1.diag.warn(`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '${configuredTemporality}', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead.`);
return exports.CumulativeTemporalitySelector;
}
function chooseTemporalitySelector(temporalityPreference) {
// Directly passed preference has priority.
if (temporalityPreference != null) {
if (temporalityPreference === OTLPMetricExporterOptions_1.AggregationTemporalityPreference.DELTA) {
return exports.DeltaTemporalitySelector;
}
else if (temporalityPreference === OTLPMetricExporterOptions_1.AggregationTemporalityPreference.LOWMEMORY) {
return exports.LowMemoryTemporalitySelector;
}
return exports.CumulativeTemporalitySelector;
}
return chooseTemporalitySelectorFromEnvironment();
}
const DEFAULT_AGGREGATION = Object.freeze({
type: sdk_metrics_1.AggregationType.DEFAULT,
});
function chooseAggregationSelector(config) {
return config?.aggregationPreference ?? (() => DEFAULT_AGGREGATION);
}
class OTLPMetricExporterBase extends otlp_exporter_base_1.OTLPExporterBase {
_aggregationTemporalitySelector;
_aggregationSelector;
constructor(delegate, config) {
super(delegate);
this._aggregationSelector = chooseAggregationSelector(config);
this._aggregationTemporalitySelector = chooseTemporalitySelector(config?.temporalityPreference);
}
selectAggregation(instrumentType) {
return this._aggregationSelector(instrumentType);
}
selectAggregationTemporality(instrumentType) {
return this._aggregationTemporalitySelector(instrumentType);
}
}
exports.OTLPMetricExporterBase = OTLPMetricExporterBase;
//# sourceMappingURL=OTLPMetricExporterBase.js.map

View File

@@ -0,0 +1,25 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.AggregationTemporalityPreference = void 0;
var AggregationTemporalityPreference;
(function (AggregationTemporalityPreference) {
AggregationTemporalityPreference[AggregationTemporalityPreference["DELTA"] = 0] = "DELTA";
AggregationTemporalityPreference[AggregationTemporalityPreference["CUMULATIVE"] = 1] = "CUMULATIVE";
AggregationTemporalityPreference[AggregationTemporalityPreference["LOWMEMORY"] = 2] = "LOWMEMORY";
})(AggregationTemporalityPreference = exports.AggregationTemporalityPreference || (exports.AggregationTemporalityPreference = {}));
//# sourceMappingURL=OTLPMetricExporterOptions.js.map

View File

@@ -0,0 +1,28 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.OTLPMetricExporterBase = exports.LowMemoryTemporalitySelector = exports.DeltaTemporalitySelector = exports.CumulativeTemporalitySelector = exports.AggregationTemporalityPreference = exports.OTLPMetricExporter = void 0;
var platform_1 = require("./platform");
Object.defineProperty(exports, "OTLPMetricExporter", { enumerable: true, get: function () { return platform_1.OTLPMetricExporter; } });
var OTLPMetricExporterOptions_1 = require("./OTLPMetricExporterOptions");
Object.defineProperty(exports, "AggregationTemporalityPreference", { enumerable: true, get: function () { return OTLPMetricExporterOptions_1.AggregationTemporalityPreference; } });
var OTLPMetricExporterBase_1 = require("./OTLPMetricExporterBase");
Object.defineProperty(exports, "CumulativeTemporalitySelector", { enumerable: true, get: function () { return OTLPMetricExporterBase_1.CumulativeTemporalitySelector; } });
Object.defineProperty(exports, "DeltaTemporalitySelector", { enumerable: true, get: function () { return OTLPMetricExporterBase_1.DeltaTemporalitySelector; } });
Object.defineProperty(exports, "LowMemoryTemporalitySelector", { enumerable: true, get: function () { return OTLPMetricExporterBase_1.LowMemoryTemporalitySelector; } });
Object.defineProperty(exports, "OTLPMetricExporterBase", { enumerable: true, get: function () { return OTLPMetricExporterBase_1.OTLPMetricExporterBase; } });
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1,21 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.OTLPMetricExporter = void 0;
var node_1 = require("./node");
Object.defineProperty(exports, "OTLPMetricExporter", { enumerable: true, get: function () { return node_1.OTLPMetricExporter; } });
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1,33 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.OTLPMetricExporter = void 0;
const OTLPMetricExporterBase_1 = require("../../OTLPMetricExporterBase");
const otlp_transformer_1 = require("@opentelemetry/otlp-transformer");
const node_http_1 = require("@opentelemetry/otlp-exporter-base/node-http");
/**
* OTLP Metric Exporter for Node.js
*/
class OTLPMetricExporter extends OTLPMetricExporterBase_1.OTLPMetricExporterBase {
constructor(config) {
super((0, node_http_1.createOtlpHttpExportDelegate)((0, node_http_1.convertLegacyHttpOptions)(config ?? {}, 'METRICS', 'v1/metrics', {
'Content-Type': 'application/json',
}), otlp_transformer_1.JsonMetricsSerializer), config);
}
}
exports.OTLPMetricExporter = OTLPMetricExporter;
//# sourceMappingURL=OTLPMetricExporter.js.map

View File

@@ -0,0 +1,21 @@
"use strict";
/*
* Copyright The OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.OTLPMetricExporter = void 0;
var OTLPMetricExporter_1 = require("./OTLPMetricExporter");
Object.defineProperty(exports, "OTLPMetricExporter", { enumerable: true, get: function () { return OTLPMetricExporter_1.OTLPMetricExporter; } });
//# sourceMappingURL=index.js.map