apify 3.2.0 → 3.2.1

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/utils.d.ts CHANGED
@@ -3,6 +3,11 @@
3
3
  * @internal
4
4
  */
5
5
  export declare function logSystemInfo(): void;
6
+ /**
7
+ * Logs info about system, node version and apify package version.
8
+ * @internal
9
+ */
10
+ export declare function checkCrawleeVersion(): void;
6
11
  /**
7
12
  * Prints a warning if this version of Apify SDK is outdated.
8
13
  * @ignore
package/utils.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAaA;;;GAGG;AACH,wBAAgB,aAAa,SAQ5B;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,SAOtC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,wBAAgB,aAAa,SAQ5B;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,SA8BlC;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,SAOtC"}
package/utils.js CHANGED
@@ -1,14 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.printOutdatedSdkWarning = exports.logSystemInfo = void 0;
3
+ exports.printOutdatedSdkWarning = exports.checkCrawleeVersion = exports.logSystemInfo = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const node_os_1 = require("node:os");
6
+ const node_path_1 = require("node:path");
6
7
  const consts_1 = require("@apify/consts");
7
8
  const log_1 = tslib_1.__importDefault(require("@apify/log"));
8
9
  // @ts-expect-error if we enable resolveJsonModule, we end up with `src` folder in `dist`
9
10
  const package_json_1 = require("@crawlee/core/package.json");
10
11
  // @ts-expect-error if we enable resolveJsonModule, we end up with `src` folder in `dist`
11
12
  const package_json_2 = require("apify-client/package.json");
13
+ const fs_extra_1 = require("fs-extra");
12
14
  const semver_1 = tslib_1.__importDefault(require("semver"));
13
15
  // @ts-expect-error if we enable resolveJsonModule, we end up with `src` folder in `dist`
14
16
  const package_json_3 = require("./package.json");
@@ -26,6 +28,39 @@ function logSystemInfo() {
26
28
  });
27
29
  }
28
30
  exports.logSystemInfo = logSystemInfo;
31
+ /**
32
+ * Logs info about system, node version and apify package version.
33
+ * @internal
34
+ */
35
+ function checkCrawleeVersion() {
36
+ const paths = [
37
+ // when users install `crawlee` package, we need to check its core dependency
38
+ (0, node_path_1.normalize)(`${process.cwd()}/node_modules/crawlee/node_modules/@crawlee/core/package.json`),
39
+ // when users install `@crawlee/cheerio` or other crawler package, we need to check the dependency under basic crawler package
40
+ (0, node_path_1.normalize)(`${process.cwd()}/node_modules/@crawlee/basic/node_modules/@crawlee/core/package.json`),
41
+ // also check paths via `require.resolve` to support pnpm
42
+ require.resolve('crawlee/package.json'),
43
+ require.resolve('@crawlee/basic/package.json'),
44
+ ];
45
+ for (const path of paths) {
46
+ if (!(0, fs_extra_1.pathExistsSync)(path)) {
47
+ continue;
48
+ }
49
+ let version;
50
+ try {
51
+ version = (0, fs_extra_1.readJSONSync)(path).version;
52
+ }
53
+ catch {
54
+ //
55
+ }
56
+ if (version != null && version !== package_json_1.version) {
57
+ const details = `User installed version (${version}) found in ${path}.\nSDK uses ${package_json_1.version} from ${require.resolve('@crawlee/core')}`;
58
+ // eslint-disable-next-line max-len
59
+ throw new Error(`Detected incompatible Crawlee version used by the SDK. User installed ${version} but the SDK uses ${package_json_1.version}.\n\n${details}`);
60
+ }
61
+ }
62
+ }
63
+ exports.checkCrawleeVersion = checkCrawleeVersion;
29
64
  /**
30
65
  * Prints a warning if this version of Apify SDK is outdated.
31
66
  * @ignore
package/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;;AAAA,qCAA+B;AAE/B,0CAA+C;AAC/C,6DAA6B;AAC7B,yFAAyF;AACzF,6DAAu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